【发布时间】:2018-10-16 12:18:53
【问题描述】:
我正在尝试使用 TOAD 计算 Impala 上几个月的总损失
以下查询抛出错误 -选择列表表达式不是由聚合输出生成的(从 group by 子句中丢失)
select
segment,
year(open_dt) as open_year,
months,
sum(balance)
sum(loss) over (PARTITION by segment,year(open_dt) order by months) as NCL
from
tableperf
where
year(open_dt) between 2015 and 2018
group by 1,2,3
【问题讨论】:
-
您应该包括样本数据和所需的结果。
标签: sql group-by window-functions impala