新增sql后面可以跟where条件(多表关联新增数据和复制数据)

1。在sql中新增数据的时候,必须条件是,insert的字段在(select)的表里面的字段是有的

insert into table_name( v1,v2,v3) VALUES (select a,b,c from 查询表 where 条件)

2.此sql可复制数据

insert into inj_wash_updatelog g (g.proid,g.update_date)
select t.proid,t.subdate from inj_wash_pro t
where t.proid not in(select g.proid from inj_wash_updatelog g)

原文地址:https://www.cnblogs.com/Darkqueen/p/9530009.html