MySQL Forums
Forum List  »  General

Re: finding unmatched values from two columns
Posted by: David Shrewsbury
Date: September 20, 2006 08:16AM

First of all, I'm sure it's a typo, but those commas in the WHERE clause should be periods. :-)

Second, what you are looking for is an outer join. To find rows in t1 that are not in t2, try this:
SELECT t1.c1
FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c2
WHERE t2.c2 IS NULL;
You can find more information (albeit a bit wordy) on the JOIN syntax here: http://dev.mysql.com/doc/refman/5.0/en/join.html

-Dave



Edited 1 time(s). Last edit at 09/20/2006 08:17AM by David Shrewsbury.

Options: ReplyQuote


Subject
Written By
Posted
Re: finding unmatched values from two columns
September 20, 2006 08:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.