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

Exception Query in access

Status
Not open for further replies.

robgoose

IS-IT--Management
Aug 24, 2003
4
US
I think this might be neat. I have two tables that have three fields that MAY be identical. I want to link the two tables and run a query that only returns the fields that are NOT identical. Any information would be highly appreciated.
 
This query SQL selects the records from tableA where there is NOT a match on ALL of the three fields join to tableB. If you want to also see the records that do not match the other way we can do that through a UNION query that reverses the process. Let me know.

Select A.Field1, A.Field2, A.Field3
FROM tableA as A INNER JOIN tableB as B ON (A.Field1 = B.Field1) and (A.Field2 = B.Field2) and (A.Field3 = B.Field3)
WHERE B.field1 = Null or B.Field2 = Null or B.Field3 = Null;

Post back with any questions.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top