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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Export two tables data into one big table

Status
Not open for further replies.

wg26

Programmer
Mar 21, 2002
135
US
Hi, Everyone:

I am trying to do denormalization. I created one big table which has all the columns included in two seperate tables.Now I want to export these two table's data into this one table. But since these two table's relationship is one to many, I am wondering how I can export data from these two tables to this one big table without losing any data. Can anyone give me some suggestions please. Thanks...
 
I hope this doesn't look to cryptic, but the gyst of it is there:

SELECT [field1].[table1],
[field2].[table1],
[field3].[table1],
[field2].[table2],
[field3].[table2]
FROM table1 INNER JOIN table2 ON
[field1].[table1] = [field1].[table1]; Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
Thanks CraigSender. It's very helpful.
But I guess what I really want to do is to physically export data from these two tables into the one big table I created. From query you have given is more like to retrive the data from two tables instead of exporting them into another table.Is there a way to do it? Thanks...
 
I have got it solved...Thanks!
 
Actually, it is not that hard. But my method may be not the best way to go. But it works anyway.

I first created one large table, which includes all the columns from two tables.
And then, I created a view by using these two tables.
And the last I did was to import the data from this view. Hope it helps.
 
Or what you could do is this. Make the query so that it simulates what you want your recordset to look like. Then use the DTS (Data Transformations Services) Engine.

Run DTS, it opens up a wizard, the first page you select the database with your tables, the second page you select the database where you want to put the table, the 3rd page is table source. Choose Use a query to select records. Put your query in there, then the next page you choose a destination, this can be a new table.

Exoprt the data using the query from your old tables into your new big one. Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top