Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Compare records in separate tables

Posted on 2011-02-14
3
Medium Priority
?
336 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
[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
3 Comments
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 1000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

610 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