Unmatched Query?

G

GL

I have two databases that I am trying to compare. I want to make sure that
not only is someone in both of the databases, but that their coverage is the
same in both.

So say you have the following data...

Database A

SSN 1 Coverage B
SSN 2 Coverage A
SSN 4 Coverage A

Database B
SSN 1 Coverage A
SSN 3 Coverage A
SSN 4 Coverage A


I want a query that will return SSN 1, 2 and 3, but not 4; because 1 has
different coverage in A than B and 2 & 3 are not in databases B & A
respectively, and 4 is the same in both. I was able to use an unmatch query
to return 2 & 3 as results, but cannot figure out how to return the result
for SSN 1.

I haven't used Access for a while, so I may be overlooking something obvious.
 
K

KARL DEWEY

Use a union query to pull list.
TableA-TableB_Union ---
SELECT TableA.CallID
FROM TableA
UNION SELECT TableB.CallID
FROM TableB;

Then compare everything --
SELECT [TableA-TableB_Union].CallID, TableA.Score, TableB.Score
FROM ([TableA-TableB_Union] LEFT JOIN TableA ON [TableA-TableB_Union].CallID
= TableA.CallID) LEFT JOIN TableB ON [TableA-TableB_Union].CallID =
TableB.CallID
WHERE (((TableA.CallID) Is Null)) OR (((TableB.CallID) Is Null)) OR
(((TableB.Score)<>[TableA].[Score] Or (TableB.Score) Is Null)) OR
(((TableA.Score)<>[TableB].[Score] Or (TableA.Score) Is Null));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top