如果不重复 insert [table](字段1,字段2,字段3) select 字段1,字段2,字段3 from table1 union all select 字段1,字段2,字段3 from table2 union all select 字段1,字段2,字段3 from table3 如果要消除重复insert [table](字段1,字段2,字段3) select 字段1,字段2,字段3 from table1 union select 字段1,字段2,字段3 from table2 union select 字段1,字段2,字段3 from table3
--新表不存在 select * into 新表名 from 表1,表2,表3 where where ... --新表已存在 insert into 新表名(...) select * from 表1,表2,表3 where ...
insert [table](字段1,字段2,字段3)
select 字段1,字段2,字段3 from table1
union all
select 字段1,字段2,字段3 from table2
union all
select 字段1,字段2,字段3 from table3
如果要消除重复insert [table](字段1,字段2,字段3)
select 字段1,字段2,字段3 from table1
union
select 字段1,字段2,字段3 from table2
union
select 字段1,字段2,字段3 from table3
select * into 新表名 from 表1,表2,表3 where where ...
--新表已存在
insert into 新表名(...) select * from 表1,表2,表3 where ...
在存储过程中可以实现动态的 insert 表的数据