首页 > 解决方案 > get calculation value from previous row on postgresql

问题描述

| Date          | Pending        | Total
| 01-04-2021    | 5              |  4
| 01-03-2021    | 2              |  1
| 01-02-2021    | 1              |  1
| 01-01-2021    | 3              |  0

I want to update my table in PostgreSQL to have calculation from previous row which is previous day and get the value like the column above on Total

Total = Pending(today) - Total(day before)

标签: postgresqlupdates

解决方案


推荐阅读