0
我正在嘗試在'Value'列中根據前一行記錄在'Increment'列中執行一些操作SQL Server逐行操作
例如,
row_num| Period | Measure | Decay
1 | Jan 08 | 10 |
2 | Feb 08 | 18 |
3 | Mar 08 | 7 |
4 | Apr 08 | 67 |
我想基於公式
row_num| Period | Measure| Decay
1 | Jan 08 | 10 | = 10 -> first value in 'Measures'
2 | Feb 08 | 18 | = 10*0.5+18 = 23 -> previous decay record *0.5 + current measure
3 | Mar 08 | 7 | = 23*0.5+7 = 18.5
4 | Apr 08 | 67 | = 18.5*0.5+67 = 76.25
將光標適用這裏更新列「衰變」?語法怎麼樣? 謝謝
6個問題,0接受? 「再見。 – egrunin 2010-07-07 04:57:40
很酷。謝謝!不知道它是這樣工作的 – marilyn 2010-07-07 08:39:45