5
I would like to know if there is any way to calculate the difference between values that are in the same column. For example: I have a table with 2 fields: date and balance. I need to add a new field, containing the balance difference from one date to another.
Dia Saldo Variação
------------------------------
01/12 --- 10 ------- 0
02/12 --- 30 ------- 20
03/12 --- 70 ------- 40
04/12 --- 80 ------- 10
You can even use the date field itself for comparison and sorting instead of Id (which does not appear in the example and may not even be sequential). Good solution. + 1
– Caffé
Sure, as long as there’s only one movement per date
– Thiago Thaison
In this case it is only one record per date. Thank you very much! I just didn’t understand how to solve by just comparing dates, without using id.
– samuelgp
@samuelgp Exactly the same way - in command just switch field
id
across the countrysidedia
.– Caffé