-
Exclusive Selection
Hello.
I'm working with a access v.2 database.
This are 2 tables from where I need to collect some data:
Table Account
|ID|Name
|1 |James
|2 |Stewart
|3 |Bill
|4 |Bob
Table AccountTMP
|ID|
|1 |
|4 |
The fields ID are PK on both tables.
How do I select the data not existing on the AccountTMP table (ID=2, ID=3), based on the Account fields?
Thank you.
-
Re: Exclusive Select
should it be something like this?
Select account.id
from account
where account.id not in
(Select * from AccountTMP)
Thank you.
-
Re: Exclusive Selection
I would consider a join operation first - it's more natural for SQL to process.
Code:
Select * From Account AC
Left Join AccountTmp AT on AT.Id=AC.Id
Where AT.Id is null
If you want to test your method though - the proper syntax would be more like:
Code:
Select account.id
from account
where account.id not in
(Select Id from AccountTMP)