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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minus Query

Status
Not open for further replies.

funkmonsteruk

IS-IT--Management
Feb 8, 2002
210
GB
I have two queries, the first contains all of my population of data, the secound contains all the data which i don't want to include in my final report. All of the secound table is contained with the first and both tables have a common field TblID.

I basically want to do a minus query where i only report on the items in the first query which aren't in the secound query.

I've tried doing the whole process with a single query, but this doesn't work as the each TblID can have several events which would decide which query it would belong to... Does anybody have any suggestions?

 
Try this:

select * from table1 where table1.tblid not in (select tblid from table2)

If this doesn't work, please give us some more information about the structure of your tables.

John
 
Select table1.*
From table1 left join table2 on table1.tblid = table2.tblid
Where table2.id is null



Vince
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top