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.
Author |
Topic |
kadiyalabindu
Starting Member
7 Posts |
Posted - 2005-09-21 : 03:57:12
|
Hi All,Actually my table is like thisday sales1 201 402 602 120From this I need the following outputday sales1 201 602 602 180Can anyone help me in solving this problemThank u in Advance |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-09-21 : 06:11:13
|
search here for items on "running total"....it's come up before. |
 |
|
kadiyalabindu
Starting Member
7 Posts |
Posted - 2005-09-21 : 07:10:03
|
Hi AndrewMurphy,I tried with that also. I cudn't get the output.Thank u |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-21 : 07:10:28
|
If you want to show this result in Reports then make use of Running Total Feature of the report. If there are thousands of rows then you will get performance issues when you try to do this in queryMadhivananFailing to plan is Planning to fail |
 |
|
kadiyalabindu
Starting Member
7 Posts |
Posted - 2005-09-21 : 07:12:15
|
Hi Madhivanan,Thank u for your advice. But I need that ouput using query only. |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-21 : 07:35:33
|
Select day, (select sum(sales) from yourTable where [day]<=T.[day]) as RunningTotal from yourTable TMadhivananFailing to plan is Planning to fail |
 |
|
kadiyalabindu
Starting Member
7 Posts |
Posted - 2005-09-21 : 10:51:58
|
Hi Madhivan,Thank u . But the above query is not working. |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-22 : 02:24:42
|
Did you get any error or unexpected result?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|