Merging Two Tables

  • Thread starter Francis Cunningham, Jr.
  • Start date
F

Francis Cunningham, Jr.

Hi,
I have a Table A and a Table B. Can I merge Table B into Table A. Both
tables have the exact same fields, primary fields and properties. End result
being a larger table A then deleting table B.
Thanks
Frank
 
J

Jeff Boyce

Francis

If you are assured there's no possibility of duplicates in the two tables,
one approach would be to create a query using TableB. Then convert that
query to an append query, to append TableB's records to TableA.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Douglas J. Steele

And if there is a chance of duplicates in the two tables, have the query
only return the records that only exist in TableB.

The SQL will look something like:

INSERT INTO TableA (Field1, Field2)
SELECT Field1, Field2
FROM TableB
WHERE TableB.Field1 NOT IN (SELECT Field1 FROM TableA)

or

INSERT INTO TableA ( Field1, Field2 )
SELECT TableB.Field1, TableB.Field2
FROM TableB LEFT JOIN TableA
ON TableB.Field1 = TableA.Field1
WHERE TableA.Field1 Is Null
 
Top