hue没有捕获空值

zzlelutf  于 2021-07-26  发布在  Java
关注(0)|答案(1)|浏览(220)

我正在尝试对空值进行计数,但是它不能对空值进行计数。
表格示例:

Country Id  Id_typ  Info
Us      123 NULL    Testing
Us      124 NULL    Testing
Us      125 Bob     testing

这是我计算空值的脚本

select count(id_typ) from combined_a where id_typ= 'NULL' limit 1

我试过了

select count(id_typ) from table_a where id_typ is null limit 1

但是,当我将条件更改为search id\u typ=bob时,它能够进行计数。我不确定我做错了什么,有什么建议吗?

06odsfpq

06odsfpq1#

你需要 is null 以及 count(*) :

select count(*)
from table_a
where id_typ is null;
``` `limit 1` 是多余的。具有聚合函数且没有 `group by` 总是返回一行。

相关问题