Select * From JWOrderInfo Where ID Not In (Select JWOrderID From CDOrderInfo )
当JWOrderID字段存在空值,也就是null时,会查不出如何东西,因为null不能参与比较运算,
正确写法是加上非null的判断
Select * From JWOrderInfo Where ID Not In (Select JWOrderID From CDOrderInfo where JWOrderID is not null)
SELECT * FROM t1 INNER JOIN t2 ON t1.name = t2.name
如果name里有null,这里是连接不了的,null=null不成立,null<>null也不成立