|
-
cumulative aggregation in a query
Hi falks,
I have the following query:
SQL> SELECT
2 to_char(trunc(T_PPV_ORDER.CREATE_DATE,'month'),'mm/yyyy'),
3 sum(T_PPV_ORDER.PRICE)
4 FROM
5 T_PPV_ORDER
6 GROUP BY
7 trunc(T_PPV_ORDER.CREATE_DATE,'month')
8 ;
TO_CHAR SUM(T_PPV_ORDER.PRICE)
------- ----------------------
03/2004 4500
04/2004 5400
05/2004 1400
06/2004 1500
07/2004 1500
This query dispaly the total price which payed for a program per month.
Now i need to add a new coulmn to the query: Cumulative revenue.
The result should be as the following:
TO_CHAR SUM(T_PPV_ORDER.PRICE) Cumuilative Revenue
------- ---------------------- -------------------
03/2004 4500 4500
04/2004 5400 9900
05/2004 1400 11300
06/2004 1500 12800
07/2004 1500 14300
The cumultive revenue displays the cumulative total price per the month.
How can i do it?
Is there a specific analitic function which treats this issue?
Thanks in advance,
Nir
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|