-1
我想要在sql 2008中添加以下表格的前一個餘額的代碼。像如何在sql 2008中計算以前的餘額
Balance= + Debit
Balance= -Credit
AccountReceivable
+----+------------+----------+----------+----------+---------+-------+--------+---------+-----+
| ID | AR_Date | Ref_No | Acc_Code | Acc_Name | Details | Debit | Credit |Balance | |
+----+------------+----------+----------+----------+---------+-------+--------+---------+-----+
| 1 | 2013-04-10 | | 101 | A/R | Kofi | 500 | | 0 | |
| 2 | 2013-04-10 | | 101 | A/R | AMA |0 | | 250 | |
| 3 | 2013-04-11 | CH552778 | 101 | A/R | Boss | 0 | | 50 | |
+----+------------+----------+----------+----------+---------+-------+--------+---------+-----+