我想计算累积列。我想要的结果位于“Cumul_result”列中的第二个表中。
我有这张桌子:
我尝试了这个请求,但它不起作用:
select Article,
Year,
Quantity ,
Sum(Quantity) over ( order by Year) as Cumul_result
FROM TABLE;
你能帮我吗? 谢谢
你几乎是正确的,你需要做的就是
partition by
文章:
select Article,
Year,
Quantity ,
Sum(Quantity) over (partition by Article order by Year) as CUMUL_PPPI
FROM mytable;