SELECT a.Id, a.sal, (SELECT SUM(b.sal)
FROM tbl_Testing b
WHERE b.id <= a.id) as Total
FROM tbl_Testing a
ORDER BY a.id;
Running Total Based on Multiple Columns
select *,(select sum(Credit)-sum(Debit) from Transactions where Tid<=t.Tid)
as Balance from Transactions as t
FROM tbl_Testing b
WHERE b.id <= a.id) as Total
FROM tbl_Testing a
ORDER BY a.id;
Running Total Based on Multiple Columns
select *,(select sum(Credit)-sum(Debit) from Transactions where Tid<=t.Tid)
as Balance from Transactions as t
No comments:
Post a Comment