Compare Two Columns

  • Thread starter Thread starter Jaime
  • Start date Start date
J

Jaime

I have two Queries, lets call them A and B, each returning one column,
named ID. I want to compare the ID column for A, with the ID column
for B, and return all the ID's in A that do not appear in B. Can you
all please help me out? I am completely stuck. Thanks!!!


EXAMPLE:

A: B:
ID ID
1 1
2 3
3 4
4
5

I want a query, call it C, that will return:

C:
ID
2
5
 
Create a query using the Unmatched query wizard.
Use your existing queries as the input "tables".
 
Thank you Allen. However, when I try to create this query, I get the
following error message:

You have chosen fields from record sources which the wizard cannot connect.
You may have chosen fields from a table and from a query based on that table

The problem is that the column A and column B are both seperate queries
based on the same table. Therefore, I shouldnt be getting this message (am I
correct?).

Also, do you know where the unmatched query wizard is located? I want to
make sure I am using the right wizard.

Thank You.
 
The unmatched query wizard is offered when you first try to create a new
query.

Haven't tried, but try aliasing the table in one of the source queries,
i.e.:
SELECT ID FROM A AS B;

Ultimately, the wizard creates a frustrated outer join like this:
SELECT A.ID1
FROM A LEFT JOIN A AS B ON A.ID1 = B.ID2
WHERE B.ID2 Is Null;

Note that the two fields (called ID1 and ID2 in the example above) must be
of the same data type.
 
Back
Top