有如下表:scores
其中gap为等级,1为最高级,4为最低级,score为得分现有需求:
计算每个id等级和其前一个等级之间的累计得分
在SQL中可以这么写
select id, gap, sum(score)over(partition by id order by gap desc rows between 1 preceding and current row) as total from t
在DOlphinDB中要如何实现类似功能呢?
select id, gap, msum(score, 2, 1) as total from t context by id csort score desc