"Geocrawler.com" wrote:
>
> How can I insert data from multiple tables into another table?
>
> the source tables are 3 different tables...
> example:
> I want col1 of table1 in col1 of the target-table, col6 of table2 in col2 of the
> target-table and col3 of table3 in col3 of the target-table...
>
> I tried this:
>
> insert into table dest (col1, col2, col3) SELECT col1 from table1, select col6 from
> table2, select col3 from table3;
>
> How can I get the data in that table?
>
> regards, Martin
Hi Martin
Just use:
INSERT INTO TABLE
dest
(col1, col2, col3)
SELECT
a.col1
, b.col2
, c.col3
FROM
table1 AS a
,table2 AS b
,table3 AS c
WHERE
a.ID = b.ID
AND b.ID = c.ID
;
Perhaps you need to use LEFT JOIN instead of the JOIN kommatas.
Certainly you will change the WHERE part to something useful in your case :)
Tschau
Christian