MySQL 中 不等于 会过滤掉 Null 的问题

null值与任意值比较时都为fasle

not in 、"!="、"not like"条件过滤都会过滤掉null值的数据

SELECT * from temp;

SELECT * from temp where score not in (70);

 

 返回null解决方法:

SELECT * from temp where score not in (70) or score is null;

SELECT * from temp where score IFNULL(score,'') != 70;

你可能感兴趣的:(mysql,java,android)