swray
01-24-2002, 08:37 AM
I need a simple query. I have two tables with an ID field. I need to see the records from table b that are not in table a. Can someone please help?
|
View Full Version : "not in" query swray 01-24-2002, 08:37 AM I need a simple query. I have two tables with an ID field. I need to see the records from table b that are not in table a. Can someone please help? Harry 01-24-2002, 08:50 AM SELECT Tablea.ID, Tableb.ID FROM Tableb LEFT JOIN Tablea ON Tableb.ID = Tablea.ID WHERE (((Tablea.ID) Is Null)); HTH swray 01-24-2002, 09:23 AM Ufortunately the id field does not contain unique values. The thing that makes each record unique is the combination of two fields, DB and ID. I have used the NOT IN statement before, but failed to keep a copy of the query. Sean swray 01-24-2002, 11:27 AM a variation of this worked SELECT * FROM TbSomeTable WHERE SomeID NOT IN (SELECT SomeID FROM TbSomeOtherTable WHERE Name = 'Something') this is what i used SELECT badsearch.id, badsearch.db FROM badsearch WHERE (((badsearch.id) Not In (SELECT laall.id from laall))); |