22,209
社区成员
发帖
与我相关
我的任务
分享
CREATE TABLE #temp
(
item INT
)
INSERT #temp
SELECT 1 UNION ALL
SELECT 2 UNION ALL
SELECT NULL
CREATE TABLE #temp1
(
item INT
)
INSERT #temp1
SELECT 1
--自己体会一下吧,注意NULL的情况
select * from #temp where item in (select item from #temp1)
select * from #temp where item not in (select item from #temp1)