22,207
社区成员
发帖
与我相关
我的任务
分享
语句一: select top 20000 A.id from A where A.id not in (select B.id from B)
语句二: select top 20000 A.id from A
left join B on B.id = A.id and B.id is null
select top 20000 A.id from A where not exists (select 1 from b where B.id=A.id)
这个比较好
你再试试这个
select top 2000 id from
(
select id from A
except
select id from B
) as table
select top 20000 A.id from A where not exists (select 1 from b where B.id=A.id)
SET STATISTICS IO ON
SET STATISTICS TIME ON
SET SHOWPLAN_TEXT ON