做数据分析的过程中,发现not in和in 查出来的条数不互补。name明明中有些记录在dept中不存在,但是not in时查不出记录。
解决方案:先将not in 的字段(dept)为空的值转换成任意值后再做查询
select * from sudent t where t.name in ('张三','李四') and nvl(t.dept,'1') not in ( '综合部','行政部')
做数据分析的过程中,发现not in和in 查出来的条数不互补。name明明中有些记录在dept中不存在,但是not in时查不出记录。
解决方案:先将not in 的字段(dept)为空的值转换成任意值后再做查询
select * from sudent t where t.name in ('张三','李四') and nvl(t.dept,'1') not in ( '综合部','行政部')