此查询应该适用于恕我直言:
SELECT
Year
,Month
,SUM(SomeFactMeasure) OVER (PARTITION BY Year BY Month) AS BigSum
,SUM(SomeFactMeasure) AS SmallSum
FROM SomeTable
GROUP BY 1, 2;
不幸的是,我得到了:
SELECTED NON-AGGREGATE VALUES MUST BE PART OF THE ASSOCIATED GROUP
答案 0 :(得分:1)
OLAP函数在聚合之后计算,没有更多细节SomeFactMeasure
要在组和中求和。
您需要在聚合结果上应用功能,标准SQL兼容SUM(SUM(SomeFactMeasure)) OVER
或Teradata重用别名SUM(SmallSum) OVER
。