Solved

Find subtle differences

Posted on 2014-02-11
3
231 Views
Last Modified: 2014-02-11
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.
0
Comment
Question by:TIgerV
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
try this query

SELECT [New Data].[Full name], [New Data].Grade, [New Data].Abbreviation, [New Data].Home, [New Data].TechID
FROM [New Data] LEFT JOIN [Old Data] ON ([New Data].TechID = [Old Data].TechID) AND ([New Data].[Full name] = [Old Data].[Full name]) AND ([New Data].Grade = [Old Data].Grade) AND ([New Data].Abbreviation = [Old Data].Abbreviation) AND ([New Data].Home = [Old Data].Home)
WHERE ((([Old Data].[Full name]) Is Null) AND (([Old Data].Grade) Is Null) AND (([Old Data].Abbreviation) Is Null) AND (([Old Data].Home) Is Null) AND (([Old Data].TechID) Is Null));


or use the query wizard > Find Unmatched query wizard
0
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
>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
0
 

Author Closing Comment

by:TIgerV
Comment Utility
Find unmatched was only giving me one column's difference.  However the SQL code above worked fine.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now