Make two tables match

M

Marc S

I have two tables with the same structure and much of the same information.
There is a history as to why these tables exist the way they do but the
bottom line is I need them to be identical. One table will always have the
most current records and I need to copy only the "new" records to a second
table. I've been copying and pasting until now and would like to automate
the process.

For example tblCorrect will have:

JobNum Date Description
12345 1/1/06 Descr1
23456 1/5/06 Descr2
34567 1/15/06 Descr3

and tblNotUpToDate will have:

JobNum Date Description
12345 1/1/06 Descr1
23456 1/5/06 Descr2

I need to compare the two tables and recognize the tblNotUpToDate doesn't
have the record associated with JobNum 34567 and then add it.

Thanks,
 
A

Alex Dybenko

Hi,
add new query and select unmatched query wizard - it will help to find
difference. then make one more to append data
 
J

John Spencer

Looks like an APPEND query to me.

UNTESTED SQL CODE

INSERT INTO tblNotUpToDate
SELECT tblCorrect.*
FROM tblCorrect LEFT JOIN tblNotUpToDate
ON tblCorrect.JobNum = tblNotUpToDate.JobNum
WHERE tblNotUpToDate.JobNum is Null
 
Top