Solved

Compare records in separate tables

Posted on 2011-02-14
3
328 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 38

Accepted Solution

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

Expert Comment

by:RgGray3
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

744 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

15 Experts available now in Live!

Get 1:1 Help Now