无法理解这样的结果:
SELECT COUNT(*) count FROM `persons_tmp` WHERE `p`.`medical_result1` NOT LIKE '%СО%6%'
Result: 36191
SELECT COUNT(*) count FROM `persons_tmp` WHERE `p`.`medical_result1` LIKE '%СО%6%'
Result: 140
SELECT COUNT(*) count FROM `persons_tmp`
Result: 42360
36191 + 140< 42360.怎么了?
答案 0 :(得分:8)
它不计算空值,因为null实际上意味着“未知”。如果它不知道该值,则无法进行比较,因此它只是忽略这些行。
试试看是否能弥补差异:
SELECT COUNT(*) count FROM `persons_tmp` WHERE `p`.`medical_result1` IS NULL