At 9:38 AM -0600 8/27/01, Jeff Shipman - SysProg wrote:
>I have two tables and that have a couple of
>identical columns. I would like to find out
>what of a certain column is in one table and
>not in another. I've tried the following, but
>I get errors:
>
>select col1 from tab1 where col1 not in (select col1 from tab2);
>select tab1.col1 from tab1,tab2 where tab1.col1 not in tab2;
>
>Please tell me how I can do this type of
>query.
Use a LEFT JOIN.
SELECT tab1.col1 FROM tab1 LEFT JOIN tab2 ON tab1.col1 = tab2.col1
WHERE tab2.col1 IS NULL
tab2.col1 must be declared as NOT NULL for this to work.
>
>Jeff Shipman E-Mail: [EMAIL PROTECTED]
>Systems Programmer Phone: (505) 835-5748
>NMIMT Computer Center http://www.nmt.edu/~jeff
--
Paul DuBois, [EMAIL PROTECTED]
---------------------------------------------------------------------
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