22,298
社区成员
发帖
与我相关
我的任务
分享
insert into b.dbo.Table1(Date,Date2) select t1.* from a.dbo.Table1 t1
left join b.dbo.Table1 t2
on t1.Date=t2.Date where t2.Date is null
但是如果我存在多个表,可以简化语句吗,比如:
insert into b.dbo.Table1(Date,Date2) select t1.* from a.dbo.Table1 t1
insert into b.dbo.Table3(Date,Date2) select t3.* from a.dbo.Table3 t3
left join b.dbo.Table1 t2
on t1.Date=t2.Date where t2.Date is null


[/quote]
这个语句要修改,不能直接运行,比如col1,col2。。。都要改成你自己的字段名称,另外, 关联条件也要改成你的表里的主键