sqlserver 筛选两个表不同的数据
方法一:
select A.ID from A where (select count(1) from B where B.ID = A.ID) = 0
方法二:
select A.ID from A where not exists (select 1 from B where B.ID = A.ID)
方法三:
select A.ID from A left join B on A.ID = B.ID where B.ID is null
方法四:
select distinct A.ID from A where A.ID not in (select ID from B)
方法五:
-- 相同数据 :select A.ID from A intersect select B.ID from B
select A.ID from A except select B.ID from B

浙公网安备 33010602011771号