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
 Other Forums
 MS Access
 Help me in getting the ouput

Author  Topic 

kadiyalabindu
Starting Member

7 Posts

Posted - 2005-09-21 : 03:57:12
Hi All,

Actually my table is like this

day sales
1 20
1 40
2 60
2 120

From this I need the following output

day sales
1 20
1 60
2 60
2 180

Can anyone help me in solving this problem

Thank 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.
Go to Top of Page

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
Go to Top of Page

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 query

Madhivanan

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

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.

Go to Top of Page

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 T


Madhivanan

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

kadiyalabindu
Starting Member

7 Posts

Posted - 2005-09-21 : 10:51:58
Hi Madhivan,

Thank u . But the above query is not working.

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-22 : 02:24:42
Did you get any error or unexpected result?

Madhivanan

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

- Advertisement -