List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:August 12 1999 9:06pm
Subject:Re: select into table...
View as plain text  
At 15:53, 19990812, "Martin Lilienthal" <webmaster@stripped> wrote:
>How can I insert data from multiple tables into another table?
>
>insert into table dest (col1, col2, col3) SELECT col1 from table1, select col6 from
> table2, select col3 from table3;

You have to use normal SELECT syntax, not make up your own:

insert into dest (col1, col2, col3)
select t1.col1, t2.col6, t3.col3 from table1 t1, table2 t2, table3 t3
where t1.id = t2.t1_id and t2.id = t3.t2_id

Notice that if you don't use a WHERE clause, and you're joining
tables, you'll get LOTS more rows than you're probably expecting.

Tim
Thread
select into table...Geocrawler.com12 Aug
  • Re: select into table...Thimble Smith12 Aug
  • Re: select into table...Christian Mack12 Aug