Click here to Skip to main content
15,943,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends,

i have one table and there is record like that

ID Amount
1 100
2 500
3 1500
4 5800

now i want to get record like
1 100 100
2 500 600
3 1500 2100
4 5800 7900

can any one help me for this query to get record like this...!!

Thank You all...!!
Zoltán Zörgő 3-Oct-12 5:30am    
You want a running summary?
Yatin chauhan 3-Oct-12 6:21am    
Yes Zoltan....!!

Share this answer
Yatin chauhan 3-Oct-12 6:04am    
Thank a Lot Dylan Morley....!!!!
insert into @t
select 1,10
select 2,12
select 3,3
select 4,15
select 5,23

select * from @t

select, t1.SomeNumt, SUM(t2.SomeNumt) as sum
from @t t1
inner join @t t2 on >=
group by, t1.SomeNumt
order by

Share this answer
If you need running totals in just T-SQL, start from here:[^].
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