从多个 select 插入单个 table
insert into single table from multiple select
我需要将 10 列(五对)插入到另一个 table.i 的 2 列中尝试多种方法,例如:
insert into table1(a,b) (select a1,b1 from table2),(select a2,b2 from table2)
所有 a,b 列都来自相同的数据类型
如果您想避免重复,可以使用 UNION ALL
或 UNION
。
insert into table1(a,b)
select a1,b1 from table2
UNION ALL
select a2,b2 from table2;
我需要将 10 列(五对)插入到另一个 table.i 的 2 列中尝试多种方法,例如:
insert into table1(a,b) (select a1,b1 from table2),(select a2,b2 from table2)
所有 a,b 列都来自相同的数据类型
如果您想避免重复,可以使用 UNION ALL
或 UNION
。
insert into table1(a,b)
select a1,b1 from table2
UNION ALL
select a2,b2 from table2;