Delete query comparing multiple columns

SunWuKung

Registered User.
Local time
Today, 06:52
Joined
Jun 21, 2001
Messages
172
I would like to delete records from one table that are not present in a query. I can solve the scenario when I need to compare one column:

Delete From AllRecords
Where AllRecords.ID Not In
(Select ID From MustStay)

However I cant solve this same scenario when the ID is composed of two colums which is my case.

Could somebody help?
Many thanks.
SWK
 
Sorry, I think I've got it now:

Delete From AllRecords a
Where (Not Exists
(Select * From MustStay m Where
a.ID1=m.ID1 AND a.ID2=m.ID2))
 

Users who are viewing this thread

Back
Top Bottom