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

exclude records from another query 1

Status
Not open for further replies.

fredk

Technical User
Jul 26, 2001
708
US
I know that I have seen the solution for this but I have done an advanced search with no luck.

How do I go about filtering records based on another query?

My query has a "maingroupnum" field and the query pulls all of the fields I need - Now I need to filter some of the records of this query based on information from another database. I used a query to pull the exact records to filter (called qryCOoosOnly1) This query has the same "maingroupnum" field which I wan to link to my original query - I am just not sure of details.

Thanks in advance!!!

Fred
 
Something like this ?
(to exclude from main query the records in qryCOoosOnly1)
SELECT A.* FROM myOriginalQuery A LEFT JOIN qryCOoosOnly1 B
ON A.maingroupnum = B.maingroupnum
WHERE B.maingroupnum Is Null;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Join maingroupnum in the two tables. With an inner join you will only get matching records.

Remember you can, if you prefer, base one query on another, so you can join your first query to qryCOoosOnly1.

 
PHV that is exactly what I am looking for - thanks!!!

Fred

(BNPMike - thanks for responding - in my case I want keep all records that are NOT in the other - thanks again!)

Fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top