Append only the matched fields from multiple tables

A

AlwaysLearing

Hello,
I have 5 different tables and a master table. I just want to bring in
all the records from all 5 tables into the master table. The master
table already has specific fields in it and I only want to bring in
all the fields that has the same name as the master table. For
example, the master table has field names like; LName, FName, ID,
Salary. The 5 individual tables have about
50 rows each and they have some of the same fields as the master
table, but they also have their own additonal fields that are
different from each other.. All in all, I should have 250 rows of
data in the master table with only those 4 fields name. I think if
all the tables had the same exact field name, it would be easier to do
combine them using a union query, but they all have different and
similar field names. So, how do I still combine them? thanks!
 
J

Joe

Hello,
I have 5 different tables and a master table.  I just want to bring in
all the records from all 5 tables into the master table.  The master
table already has specific fields in it and I only want to bring in
all the fields that has the same name as the master table.  For
example, the master table has field names like; LName, FName, ID,
Salary.  The 5 individual tables have about
50 rows each and they have some of the same fields as the master
table, but they also have their own additonal fields that are
different from each other..  All in all, I should have 250 rows of
data in the master table with only those 4 fields name.  I think if
all the tables had the same exact field name, it would be easier to do
combine them using a union query, but they all have different and
similar field names.  So, how do I still combine them?  thanks!

I suggest for the 5 tables you mentioned you create a query for each
table. In each query, you only select the columns you want to be added
to master table. Field names don´t matter here, only the order of the
columns, but for convenience, in queries you can use labels in order
to change the column names.

Then, as you mentioned, you create a UNION query to bring the data of
all queries together. Then, based on this UNION query, you create an
append query, and append the data to your master table. Just make sure
you add the data only once. When I do this, I normally put a condition
in my query only to show the data that are not yet in the master
table.

Hope this helps.
 

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

Top