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比较时存在一些问题。
答案 0 :(得分:4)
IN()
无法处理NULL
的值。而是使用IS
and id is not NULL
或
and id is NULL