I have two tables: products +---------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------------+--------------+------+-----+---------+----------------+ | id | int(6) | | PRI | NULL | auto_increment | | fg_number | varchar(9) | | MUL | 0 | | | product_name | varchar(64) | | MUL | | | | product_description | varchar(255) | | | | | +---------------------+--------------+------+-----+---------+----------------+
and images +---------------+--------------------------------------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+--------------------------------------------------+------+-----+---------+----------------+ | id | int(6) | | PRI | NULL | auto_increment | | fg_number | varchar(8) | | | | | | image_name | varchar(64) | | | | | | thumbnail | varchar(255) | YES | | NULL | | | image_path | varchar(255) | | | | | | color_depth | enum('rgb','cmyk','greyscale','bitmap','vector') | YES | | NULL | | | width_inches | decimal(6,0) | YES | | 0 | | | height_inches | decimal(6,0) | YES | | 0 | | | resolution | decimal(6,0) | YES | | 0 | | | filesize | varchar(36) | YES | | NULL | | | filetype | varchar(36) | YES | | NULL | | | notes | text | YES | | NULL | | +---------------+--------------------------------------------------+------+-----+---------+----------------+ I've got a web page (php) that's displaying the images available for a particular product using a query like: select products.product_name, images.fg_number, images.image_name, images.thumbnail, images.image_path, images.color_depth, images.width_inches, images.height_inches, images.resolution, images.filesize, images.filetype, images.notes from products, images where products.fg_number ='$fg_number' and images.fg_number = products.fg_number; Which works fine, as long as there is data in the images table corresponding to a product, but in the case where there are no images related to a particular fg_number, the query returns an empty set. What I'd like to get, is the products.product_name regardless of weather there are any corresponding images, so the variable $product_name will have a value on the php page and I can generate a message something like "sorry there are no images of '$product_name' available... I can see how to do this with 2 queries, but shouldn't I be able to do it with one? and wouldn't I take a performance hit by running more than one query per page? Michael --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php