How do I calculate a running SUM on a SQLite query?

前端 未结 5 1249
渐次进展
渐次进展 2021-02-05 14:42

How do I get a column that is the sum of all the values before of another column?

5条回答
  •  星月不相逢
    2021-02-05 15:27

    You have to do a sum in the field you want.... The query depends on the database you're using, Oracle allows you to do this:

    select id, value, sum(value) as partial_sum over (order by id) from table
    

提交回复
热议问题