在使用sql语句进行查询时突然发现一个语句不能返回合适结果:
select count(*) from weibo.poi where poiid not in (select poiid from weibo.url) and poiid not in (select poiid from weibo.url_bad);
正常应该有结果,但此语句返回空集。
搜索后发现后面的not in语句中存在null值,导致返回空集。因此应该这样修改:
select count(*) from weibo.poi where poiid not in (select poiid from weibo.url) and poiid not in (select poiid from weibo.url_bad where poiid is not null);
发表回复