Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Rolling up Sums

RE: Rolling up Sums

From: Aponte, Tony <AponteT_at_hsn.net>
Date: Tue, 07 Jan 2003 14:21:17 -0800
Message-ID: <F001.005293B0.20030107142117@fatcity.com>

create table genledg (budget number(4),week number(2)) tablespace tools

insert into genledg values (100,1)

insert into genledg values (100,2)

insert into genledg values (100,3)

insert into genledg values (100,4)

commit

Select sum(budget) over (order by week) budget, week from genledg

BUDGET	WEEK
100	1
200	2
300	3
400	4

HTH
Tony Aponte

-----Original Message-----
Sent: Tuesday, January 07, 2003 2:26 PM
To: Multiple recipients of list ORACLE-L

I have some sql(below) that when run gives me Result #1. What I'm trying to do is to have week 1 roll into week 2, and the total from week 2 roll into week 3 and so forth. I've played around with the "rollup" function but I can't get it to come out like Result #2.
Anyone have any ideas or a way I could get the "rollup" function to produce results like #2?

SELECT ROUND(SUM(t1.baseline_budget),0) cc_budget,

                   t2.week_seq
  FROM ipcs.all_cost_view_outage t1,
                ipcs.week_detail t2
 WHERE t2.week_seq = t1.week_seq
       AND t2.week_detail.proj_id = 2108
 GROUP BY t2.description,
                         t2.week_seq;

Result #1

   Budget Week

      100       1
      100       2
      100       3
      100       4

Result #2

   Budget Week

      100       1
      200       2
      300       3
      400       4

Thanks all...........
bonnergj_at_songs.sce.com

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author:
  INET: bonnergj_at_songs.sce.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Aponte, Tony
  INET: AponteT_at_hsn.net

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Jan 07 2003 - 16:21:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US