I think you want SELECT * FROM a LEFT JOIN b on a.c = b.d WHERE b.d IS NULL;
The LEFT JOIN means to create a composite record from both tables even if there is no match on the right-hand table. Checking to see if b.d is null selects out those composite records that came up empty on the right-hand side. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 > -----Original Message----- > From: Aaron Cannon [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 03, 2007 3:47 PM > To: mysql@lists.mysql.com > Subject: select statement question > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi all. I hope this is the right place to ask this. > > I have two tables, A and B. Each of these tables has a column with > integers. The column in table A is C and the one in B is D. > > I need a select statement that will return all records whose > C value is not > in any row in D. > > for example: > C = > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 11 > > D = > 2 > 4 > 6 > 8 > 10 > > and the statement would return: > 1 > 3 > 5 > 7 > 11 > > Probably an easy question for those of you more experienced > but I have no > clew. > > Thanks in advance. > > Sincerely > Aaron Cannon > > > - -- > Skype: cannona > MSN/Windows Messenger: [EMAIL PROTECTED] (don't send email > to the hotmail > address.) > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.3 (MingW32) - GPGrelay v0.959 > Comment: Key available from all major key servers. > > iD8DBQFFnBbLI7J99hVZuJcRAiF3AJ4mR4UjLa0sG+hIDbErj7LvuzfU4wCggEDh > DtnfmVsHL84me4qVw/mA4s8= > =l2gE > -----END PGP SIGNATURE----- > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]