Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Rolling Sum with SQL

446742Aug 14 2005 — edited Aug 14 2005
Hi,

I am looking for a solution of rolling sum of 2 weeks, and I DON'T want to use "over (partition by week_date order by week_date)".
TABLE LOOKS as BELOW,
WEEK_DATE QTY PROD_NAME
-------------------- ------- ---------------------
7/29/2005 18 PROD1
7/22/2005 10 PROD1
7/15/2005 16 PROD1
7/8/2005 20 PROD1

Output should look like below,
WEEK_DATE QTY PROD_NAME ROLL_SUM
-------------------- ------- --------------------- --------
7/8/2005 20 PROD1 30 ( sum of pervious week)
7/15/2005 16 PROD1 36
7/22/2005 10 PROD1 26
7/29/2005 18 PROD1 28

Thanks In Advance,

-Shirish
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 11 2005
Added on Aug 14 2005
1 comment
592 views