sql将一个表的数据插入到另一个表

将表2的数据插入到表1
语法:

insert into1(插入字段)select 插入字段 from2 where ...

实战例子:

INSERT INTO1 (syncid,syncdes,tablename,keyfields,syncfields,version,serialno) 
select syncid,syncdes,tablename,keyfields,syncfields,version,serialno from2 where syncid=#{syncid}

版权声明:本文为weixin_43110289原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。