insert into table3(column1, columm2, column3, column4)
select a, b, c, d
from table1, table2
where ...
一个SELECT结果的集合,是可以直接插入到另一个表中的。insert into table... select ... from ... where...,只要select返回的字段集合顺序和要插入的对应就好。还有,可以select 常量。。。这样每一行都会插入一个常量。
insert into table3(a,b,c,d)
select table1.a,table1.b,table2.c,table2.d
from table1,table2
where table1.key = table2.key