October 13th, 2000, 02:18 AM
Very similar to selecting only those values in table1 that exist in table2 also, I want to select all those that exist in table1 but NOT in table 2.
I have no clue how to do this. I tried:
select table1.ID from table1, table2 where table1.ID <> table2.ID
but that does not work because it simply returns the rows in the reversed order.
select table1.ID from table1, table2 where table1.ID = table2.ID works for the opposite effect. (finding all rows where the value is same in the first and second table)
October 13th, 2000, 11:52 AM
Here is the sql for you..
SELECT table1.id FROM table1 LEFT JOIN table2 ON table1.id=table2.id where table2.id IS NULL
www.jobxyz.com-IT Career Portal
"The fear of the LORD is the beginning of knowledge..."
[This message has been edited by Shiju Rajan (edited October 13, 2000).]