Solved

In Access 2010 How can I find records in one table that have no exact match in another table?

Posted on 2015-02-18
6
134 Views
Last Modified: 2015-02-18
I need to find records that do not match by multiple fields.  What's a good strategy, or is there some generic SQL statements that might give me a clue?
0
Comment
Question by:Jay Williams
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 40617196
SELECT a.*
FROM a LEFT JOIN b ON
b.primarykey = a.primarykey
WHERE a.primarykey is not null and b.primarykey is null

Will give you all records in a that don't have a match in b.

Kelvin
0
 

Author Comment

by:Jay Williams
ID: 40617204
Thanks, Kevin.  I'll give it a whirl.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40617215
if you want to test for multiple fields

SELECT Table1.F1, Table1.F2, Table1.F3, Table1.F4, Table2.F1, Table2.F2, Table2.F3, Table2.F4
FROM Table1 LEFT JOIN Table2 ON (Table1.F4 = Table2.F4) AND (Table1.F3 = Table2.F3) AND (Table1.F2 = Table2.F2) AND (Table1.F1 = Table2.F1)
WHERE (((Table2.F1) Is Null) AND ((Table2.F2) Is Null) AND ((Table2.F3) Is Null) AND ((Table2.F4) Is Null));
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40617230
One of the query wizard options is a "Find Unmatched" query, which will walk you through the steps of identifying which field(s) you want to match on, and will allow you to select other fields from the table as well.
0
 

Author Comment

by:Jay Williams
ID: 40617288
Thanks again, Rey.  That's what I have in mind.  I'll let you know. :-)
0
 

Author Closing Comment

by:Jay Williams
ID: 40617325
This is pure gold--and so are you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

737 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