field not equal

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating a query , say Query1 in which I am joining 2 queries, say
Query2 and Query3. I have joined them on a common field, say Field1. Values
of Field1 are such that the set of these values in Query2 is a subset of that
of Query1. I want Query1 to result only those records from Query1 where the
field values of Field1 are not equal, that is present in Query1 and not in
Query2.
 
I think you have mixed up your references to Queries 1, 2, and 3.

If you want Query1 to return all the records from Query3 that do not have a
match in Field1 of Query2, then you can do it one of several ways. You
might want to test both methods to determine which is quickest in your
situation.

1. SELECT Query3.*
FROM Query3 LEFT JOIN Query2 ON Query3.Field1 = Query2.Field1
WHERE Query2.Field1 IS NULL

2. SELECT Query3.*
FROM Query 3
WHERE Query3.Field1 NOT IN (SELECT Query2.Field1 FROM Query2)

HTH
Dale
 
Thanks, I did mix up the references but you understood it correctly. I used
the first method as it seemed easier to implement that in design grid of
Access query and it worked
 
Back
Top