sql Server中不建议使用not in,因为会带来潜在的问题:
Caution |
---|
Any null values returned by subquery or expression that are compared to test_expression using IN or NOT IN return UNKNowN. Using null values in together with IN or NOT IN can produce unexpected results. |
语法:
test_expression [ NOT ] IN ( subquery | expression [,...n ] )
千万注意子查询和表达式中不能出现null,使用in/not in时注意检查数据有效性。