sql 查询结果插入到另一张表

insert into table1 select * from table2 --表结构相同

表结构不同或跨数据库时
insert into table1 (field1,field2,field3) select (table2.field1,table2.field2.table2.field3)from table2

select * into table1 from table2 --如果table1表不存在

猜你喜欢

转载自www.cnblogs.com/zhengxia/p/12050245.html