0
我有一個像減法在MySQL
Id_indicator Value trend Date_data
1 0 0 2011-08-18 09:16:15
1 2 1 2011-08-18 10:16:15
1 1 -1 2011-08-18 11:16:15
1 2 1 2011-08-18 12:16:15
2 21 0 2011-08-18 13:16:15
2 21 0 2011-08-18 14:16:15
2 21 0 2011-08-18 15:16:15
3 3 0 2011-08-18 16:16:15
3 4 1 2011-08-18 17:16:15
3 4 0 2011-08-18 18:16:15
4 4 0 2011-08-18 19:16:15
我需要找出什麼是基於id_indicator先前值之間的差異,在右側輸入該值增加一列的表。例如,作爲
Id_indicator Value trend Date_data Difference
1 0 0 2011-08-18 09:16:15 0
1 2 1 2011-08-18 10:16:15 2
1 1 -1 2011-08-18 11:16:15 -1
1 2 1 2011-08-18 12:16:15 1
2 21 0 2011-08-18 13:16:15 0
2 21 0 2011-08-18 14:16:15 0
2 21 0 2011-08-18 15:16:15 0
3 3 0 2011-08-18 16:16:15 0
3 4 1 2011-08-18 17:16:15 1
3 4 0 2011-08-18 18:16:15 0
4 4 0 2011-08-18 19:16:15 0
感謝
的可能的複製[MySQL的 - 從先前行減去值,由基團](http://stackoverflow.com/questions/13196190/mysql-subtracting-value - 從在先排基團的通過) – CGritton