Try: SELECT B.name FROM B LEFT JOIN A ON A.name = B.name WHERE A.name is null;
-----Original Message----- From: Pichan M. [mailto:[EMAIL PROTECTED]] Sent: Thursday, 14 March 2002 12:19 PM To: [EMAIL PROTECTED] Subject: Retrive distinct data from two tables I have 2 tables, let says, table A and table B. Each table record person name. select B.name from B, A where B.name = A.name Query above should return the name which recorded in both tables (duplicate name) In reverse, how can I retrive the name which recorded in Table B and not present in Table A? Table A name id ---------------------------------------- Johnson | 1203 Jack | 1192 Mary | 5509 Jimmy | 1189 ---------------------------------------- Table B name level ---------------------------------------- Johnson | AA Mary | AC Alex | AA Chris | AA ---------------------------------------- select B.name from B, A where B.name <> A.name this query not work as I expect, also with join _________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com --------------------------------------------------------------------- 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 --------------------------------------------------------------------- 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