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
Solved

Compare records in separate tables

Posted on 2011-02-14
3
331 Views
Last Modified: 2012-05-11
I was so hoping that I could figure this out on my own.... but alas, no such luck. So I turn to the maharishis of code....

I have two tabels: Tbl1, Tbl2
They each have a column containing emails
I want to compare each email in Tbl2 with the emails in Tbl1
If the email in Tbl2 is not present in Tbl1 then I want to add it to Tbl1

I'm working with Access07

As always, thank you for your help and guidance

~worcse
0
Comment
Question by:Worcse
3 Comments
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 250 total points
ID: 34890337
Something like:
Insert into tb2 select email from tb1 where email not in (select email from tb2)
0
 
LVL 11

Expert Comment

by:RgGray3
ID: 34890508
Employ an outerjoin between tables where you link the two tables on the email address

Right click on the join line in the query...  and select ALL records from Tb1 and only those in tb2 that match as the join type

in your query you filter the records by Where tb2.Email = Is Null

That will give you the records that exist in 1 and not 2

You can then convert the query into an insert query and insert the records into tb2

(Note...  always a good idea to create the query as a select first  then change it to an append)
0
 

Author Closing Comment

by:Worcse
ID: 34890719
aarontomosky,
With a little tweaking... I was able to get this to work!
Thank you for your help and quick reply.
Regards,
~worcse
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

809 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