标签: mysql
我在sql数据库中有三列timestamp, id, amount。如何获得每个用户的累积金额总和作为新列
timestamp, id, amount
SELECT timestamp, id, amount, SUM(amount) OVER (PARTITION BY id ORDER BY timestamp) AS RunningTotal FROM Trans
我希望输出显示基于数量的id的累积和。但是,我只是获得该ID的每一行的总和。
结果截屏: