Click here to Skip to main content
15,887,363 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am Using the following query to calculate running balance.It's working perfectly for me.i need date wise report look like Output 2.
SQL
Select
t2.tentryno,t2.tseqid,t2.glcode,t2.descript,t2.Debit,t2.Credit,t2.entrydate, (Select SUM(Debit-Credit) From balancesheet As t1 Where t1.glcode=t2.glcode and t1.tseqid <= t2.tseqid )as Amount From balancesheet As t2 where glcode='01-04-0003' order by glcode,tseqid,entrydate

for Output 1 and Output 2 plz check image link.
[^]

Plz help me

What I have tried:

I am Using the following query to calculate running balance.It's working perfectly for me.i need date wise report look like Output 2.
SQL
Select
t2.tentryno,t2.tseqid,t2.glcode,t2.descript,t2.Debit,t2.Credit,t2.entrydate, (Select SUM(Debit-Credit) From balancesheet As t1 Where t1.glcode=t2.glcode and t1.tseqid <= t2.tseqid )as Amount From balancesheet As t2 where glcode='01-04-0003' order by glcode,tseqid,entrydate

for Output 1 and Output 2 plz check image link.
[^]

Plz help me
Posted
Updated 13-Feb-17 7:27am
v2

1 solution

See the following link that explains how to manage this:
sql - Cumulating value of current row + sum of previous rows - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900