我有一个表有以下记录。
---------------------------------------------------------
|VoucherDetailId | VoucherId | AccountId | Amount |
---------------------------------------------------------
| 2 | 1 | 2 | -5000 |
| 3 | 2 | 2 | 2000 |
| 15 | 8 | 2 | 777 |
---------------------------------------------------------
我想查询以下输出..
------------------------------------------
| AccountId | Debit | Credit | Balance |
------------------------------------------
| 2 | 0 | 5000 | (5000) |
| 2 | 2000 | 0 | (3000) |
| 2 | 777 | 0 | (2223) |
------------------------------------------
提前致谢...