Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL MINUS in ACCES with Similar Tables 1

Status
Not open for further replies.

spinalwiz

Programmer
Feb 25, 2003
32
IT
I've got a very simple table that is just a list of equipment. Theres an ID field and an Equipment field. This table is called EquipmentList

Now through a rather long SQL statement I get a table of Equipment being used for a particular event (called EquipmentInUse). Again there is just an ID field and an Equipment field.

All I want to do is get a list of equipment NOT in use.

Using 'normal' SQL I would just have to do something along the lines of:

EquipmentList MINUS EquipmentInUse

Access doesnt seem to want to let me use this very useful MINUS command (any idea why?). Through searching around I found suggestions to use the LEFT JOIN workaround but this doesnt seem to offer any help either.

EquipmentInUse LEFT JOIN EquipmentList

just gives you EquipmentInUse and

EquipmentList LEFT JOIN EquipmentInUse

gives EquipmentList


Any ideas?

Thanks
 
Hi,

Use NOT IN list
[tt]
Select ...
From ...
Where EquipmentID NOT IN (your select of the list of equipement ids)
[/tt]


Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks, I cant believe I spent so long over this. Its easy if you know how :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top