Link to home
Start Free TrialLog in
Avatar of TIgerV
TIgerVFlag for United States of America

asked on

Find subtle differences

Two Tables to compare:  "Old Data" and "New Data"
I need to query and find any difference at all in the following fields:
Full Name, Grade, Abbreviation, Home, TechID.

Key field is "Full Name"

Is there a single query that will show me any difference in any of those fields?

I would like to show the results from table "New Data", the old doesn't matter.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>Key field is "Full Name"
Bad choice, as there can be more than one person with the same name, i.e. John Smith, Jane Doe, Paddy O'Flavo, and in those cases the name is not unique.

>I need to query and find any difference ... Full Name
>Key field is "Full Name"
You can have one or the other, but not both, as SQL needs to know how to join these two tables, and if you're using Full Name then it looks for rows where the two values are the same, and has no way of knowing if different rows are a legitimate difference (Jim Horn vs. James Horn), or a difference to ignor (Danny Wareham vs. Miriam Bizup).

>Is there a single query that will show me any difference in any of those fields?
Something like..

SELECT n.[Full Name], n.Grade, n.Abbreviation, n.Home, n.TechID
FROM [New Data] n
   INNER JOIN [Old Data] o ON n.[Full Name] = o.[Full Name]
WHERE n.Grade <> o.Grade OR
   n.Abbreviation <> o.Abbreviation OR
   n.Home <> o.Home OR
   n.TechID <> o.TechID
Avatar of TIgerV

ASKER

Find unmatched was only giving me one column's difference.  However the SQL code above worked fine.