Hi all, I have two tables (Titles(title, title_id, ...), Item(item_id, title_id, ...)) which have a common field (title_id) which I intend to use to join the tables together. However, some Items have title_id's which do not match any title_id in the Titles table, don't ask me why it's someone elses database. What I'm trying to do is to join the tables using a SELECT statement that will show all Items (there are more Items than there are Titles) with a title joined by title_id and if there is no associated title_id I want to display the Item without a title.
i.e. from these tables: +------+--------+ +------+--------+ ITEM | item | title_id | TITLES | title | title_id | +------+--------+ +------+--------+ | a | 1 | | a | 1 | | b | 2 | | b | 3 | | c | 3 | +------+--------+ +------+--------+ I want: +------+-----+ | item | title | +------+-----+ | a | a | | b | | | c | b | +-----+------+ Is this possible? I've tried: SELECT item.item_id, titles.title FROM item, titles; which returns a list of every item and every title, even if unassociated, eg +------+-----+ | item | title | +------+-----+ | a | a | | b | a | | c | a | | a | b | | b | b | | c | b | etc.... and: SELECT item.item_id, titles.title FROM item, titles WHERE item.title_id = titles.title_id; which results in those items without an associated title_id being left out of the result set. Hope this makes sense. Thanks, Neil --------------------------------------------------------------------- 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