在下面给出的我的 postgresql 查询中,我想 count(completed::float)
select round(Count(completed::float)) as completed,
assignee
from NTE_23Apr19_HCMS_DOW_Defects_List_V1
group by assignee
这是我的 postgresql 表
如果我在查询中不使用 float 它会起作用,但我想用 float 执行。这可能吗
select round(Count(completed)) as completed,
assignee
from NTE_23Apr19_HCMS_DOW_Defects_List_V1
group by assignee
最佳答案
在 PostgreSQL 中没有空行这样的东西。
您的值为 ''(空字符串)或 NULL
值。
您可以通过以下方式计算它们:
sum(case when completed = '' then 1 else 0 end)
sum(case when completed is null then 1 else 0 end)
更好的是:
sum(case when coalesce(completed,'') = '' then 1 else 0 end)
- 这将涵盖这两种情况。
关于postgresql - 如何计算postgresql中的空行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55823140/