【发布时间】:2018-01-10 18:53:26
【问题描述】:
当我执行下面的查询时,我得到错误 "count" is not supported in case statements。想知道是否有解决此问题的方法。
select
sum(case when a.key1 == 80 then count(distinct a.key2) else 0 end) as no_80_counts,
from table1
【问题讨论】:
-
不支持嵌套聚合函数。你到底想做什么?
-
对于特定的 key1 值,我试图计算不同的 key2,因为 key1 可以与多个 key2 相关联