SQL存在一个表而不在另一个表中的数据,sql不在
select a.id,a.oacode,a.custid,a.custname,a.xsz,a.salename,a.communicationtheme,a.communicationproperty,a.communicationtime,a.productmanager,'' creator,a.creator oaCreator,a.createdate,case when a.oastate='正常结束' then 3 else 0 end status from reception_flow a where (1=1) and (a.oastate='正常结束' or a.oastate='反馈中' or a.oastate='已反馈') and (select count(1) as num from technology_support s where s.oacode=a.oacode)=0
select top 1 *
from tb2
where id not in (select [index] from tb1)
order by id
insert into tableA
select * from tableB b where not exists(select 1 from tableA a where a.id = b.id)
insert into tableA
select * from tableB b
left join tableA a on a.id = b.id
where a.id is null
----用 not exists来判断,left join ,其中条件为唯一性主键
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。