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

Insert data from three tables into a new table

Status
Not open for further replies.

oaklandar

Technical User
Feb 12, 2004
246
US
How would I insert data from three tables into one table using a query?

My attempt:
Code:
insert into TableFour
select * 
From TableOne, TableTwo, TableThree

It keeps saying duplicate problem.
Please advise.
 
may be you need to explicitly state the table names if there are same field names in the tables...


insert into TableFour
select t1.field1,t2.field1,t3.field1
From TableOne t1, TableTwo t2, TableThree t3

-L
 
And maybe its advisable to join the 3 tables to avoid cartesian product.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top