Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 need a query please help

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-09-01 : 06:05:58
Dear experts i need a query like this

i have a table like this.

accno name amount running_total

1 a 50 50

2 b 60 110

3 c 70 180

4 d 80 260

like this

the running total column should be automatically updated when ever i entered value to the amount column.

please help me in this regard.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-01 : 06:20:49
something like this...

SELECT ACCNO, NAME, AMOUNT, (SELECT SUM(AMOUNT) FROM TABLE Y WHERE Y.ACCNO <= X.ACCNO) AS RUNNING_TOTAL
FROM TABLE X



Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-09-01 : 06:28:51
Oh this is really great help Mr.athalye.
thank you very much for this query
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-01 : 10:22:56
Where do you want to show data?
If you use Reports use Running Total feature there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -