merge tables

  • Thread starter Thread starter Saul
  • Start date Start date
S

Saul

I have 2 tables of identicle structure. The first
(table1) contains incomplete data on the entire group of
records. The second (table2) has complete data, but only
on a subset of the (same) records as in Table1. Is there
a way to combine the data so that I will have a single
table with the entire group of records (table1) with the
information available from the subset (table2)
encorporated. I couldn't make an Append, Action or Make-
Table work. Thanks.
 
You might try this Make-Table SQL:

SELECT * INTO Table3
FROM
(
SELECT T1.*
FROM Table1 AS T1 LEFT JOIN Table2 AS T2
ON T1.PrimaryKey = T2.PrimaryKey
WHERE T2.PrimaryKey Is Null
UNION ALL
SELECT * FROM Table2
)

Robin Proctor
 
You may need to make the bracketed SELECT statement a separate query (eg
qryMerge) if your Access version won't take it. Your Make_Table SQL becomes

SELECT * INTO Table3
FROM qryMerge

Robin Proctor
 
Perhaps an update query? Is there some field(s) that will allow you to join the
two tables together.

UPDATE YourTable1 INNER JOIN YourTable2
ON YourTable1.KeyField = YourTable2.Keyfield
Set YourTable1.Field1 = YourTable2.Field1,
YourTable1.Field2 = YourTable2.Field2
 
Back
Top