Append Query - Excluding existing records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Thanks in advance !
Having trouble with the syntax.
I have a master table and a file i receive daily. The daily has all of the
master records and some new ones. As I have enriched the master file with
other attributes I simply want to add the new records on the daily file to
the master table. Do I simply append all and rely on the primary key not
allowing me to overwrite existing records, or can i select just the records I
want as a part of the append ?
Thanks.
 
I believe something along these lines would get you the results that you want:


INSERT INTO Master( record_id, record_data )
SELECT Daily.record_id, Daily.record_data
FROM Daily
WHERE (((Daily.record_id) Not In (SELECT record_id FROM Master)));

You just need to replace the table and field names that I made up with the
ones you are using, and add more fields if you need to.

Gina
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top