insert into select查询疑问
table1查询结果
select id ,name,age from table1 where...
id name age
1 Nick 30
2 Emma 26
table2查询结果
select id ,position from table2 where...
id position
1 Teacher
2 Doctor
3 Doctor
现在要将这两个查询结果合并在一起,id一致的才能合并在同一行上
id name aged position
1 Nick 30 Teacher
2 Emma 26 Doctor
查询语句是这么写的么
Insert into (select id ,name,age from table1 where...)(potion) select id ,position from table2 where...where table1.id=table2.id
table1和table2的查询结果不想在insert into select前查询出,那样的话还要重新建表