Deselect (Not delete) common records of two query

  • Thread starter Thread starter Azad,DH, BD
  • Start date Start date
A

Azad,DH, BD

Dear Experts,

I'm badly in need of your help. pls, help me. I've 2 query and finally I'd
like to make the 3rd query that will only select all records except the
common records of both query. How can I do that?

Waiting for your response.


Thanks.
 
Generically, you could use a union query to get the records not in one
query (unmatched query wizard) and not in the other query. Assuming
that the fields returned by the two queries were the same and in the
same order the UNION query might look like the following.

SELECT Query1.*, "In Q1 Only" as Source
FROM Query1 LEFT JOIN Query2
ON Query1.MatchField = Query2.Matchfield
WHERE Query2.MatchField is Null
UNION ALL
SELECT Query2.*, "In Q2 Only" as Source
FROM Query2 LEFT JOIN Query1
ON Query2.MatchField = Query1.Matchfield
WHERE Query1.MatchField is Null


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Back
Top