select count(*) from call_log
where relation_id in (14,15)
and date(from_unixtime(created_time/1000)) = '2018-12-10';
结果:1600
select count(*) from call_log
where relation_id in (14,15)
and date(from_unixtime(created_time/1000)) = '2018-12-10'
and id not in (NULL);
结果:0
select count(*) from call_log
where relation_id in (14,15)
and date(from_unixtime(created_time/1000)) = '2018-12-10'
and id in (NULL);
结果:0
理想情况下,查询2和查询3的结果之和应该等于查询1的结果。或者与null比较时出现问题。
1条答案
按热度按时间aiazj4mn1#
IN()
无法处理NULL
价值观。而是使用IS
```and id is not NULL
and id is NULL