Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining two tables

Status
Not open for further replies.

morrow314

MIS
Apr 10, 2000
12
0
0
US
I want to import a table into my db and add the data to a pre-existing table. Problem is the imported table and the existing table have some fields that are same, some that are different.

ex. Table 1 - fields 1, 2, 3, 5, 6
Table 2 - fields 1, 2, 3, 7, 8, 9

What is the best way to do this? Do I have to make the fields the same in both tables in order to combine the two?
Any help is appreciated.
 
OK, I am going to assume that you want your final table to have fields 1 2 3 5 6 7 8 and 9.

Import the data into a table. make sure that the existing table has ALL of the fields you need, including blank fields for the data from the imported table.

Then, use an Update query to fill in the data in the existing table from the imported table.

Give this a try and post if you need more help. Kathryn


 
What you will need to do is create a new query and make it an append query.
Selecting the table you want to add the data to.

Once you have done this the query grid will show you append from and append to fields for the table in question by default if the field names are the name the append query will assume that is where you want the data to go. If that is not the case simply select the field you desire and then run the query.

To be on the safe side make copies of both the tables before you run the query. That way if something was defined wrong you will be able to go back to the original data without any problem.

I hope this helps.


Steve B-)
 
Looking at the post from Kathryn. I assumed that you merely wanted to add data from one table to another. If you wanted to modify what was already there then running a update query as Kathryn suggested would be the way to go.

In either event. Make a copy of the tables before you run the query. Trust me this will save you a lot of frustration if something goes wrong.

Good luck,

Steve
 
Steve,

Excellent point; I second and third the suggestion to make a copy of the tables!

Kathryn


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top