select * from mubiao where item in (select item from producttest)这条语句,可以查询出来结果。但是,要是变成了select * from mubiao where item not in (select item from producttest)就查不出来任何结果了。为什么加了not,没有把item中没有的数据查找出来呢?
调试欢乐多
not in 的意思是:item 不在(select)中
(
item INT
)
INSERT #temp
SELECT 1 UNION ALL
SELECT 2 UNION ALL
SELECT NULLCREATE 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)
是item 的值在mubiao 表中有多条吧。。
7964-7486=478条select item from mubiao group by item having count(*)>1;看看返回值是否478
7964-7486=478条select item from mubiao group by item having count(*)>1;看看返回值是否478