Originally Posted by
kkbharat
Could you tell me whether it is possible to some how sum the amount from previous records for the same field.
As I wrote in my 1st answer, you can query the sum of field(s) where row's date field has date less or equal (otherwise the current Duty paymet is left out) than date in current row. Probably something like (on fly)
Code:
SELECT
t.OrderNo,
t.ReceiptNo,
t.ReceiptDate,
t.RecieptAmount,
t.Purpose,
t.PartPament,
t.Duty,
(SELCT SUM(00.Duty) FROM tblTest t00 WHERE t00.OrderNo = t.OrderNo) - (SELECT SUM(t0.Duty) FROM tblTest t0 WHERE t0.OrderNo = t.OrderNo AND t0.ReceiptDate <= t.ReceiptDate) As DutyBalance
FROM tblTest t
ORDER BY t.OrderNo, t.ReceiptDate