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

Home -> Community -> Usenet -> c.d.o.misc -> Computing cumulative values with SQLplus

Computing cumulative values with SQLplus

From: Alan Long <tics28_at_>
Date: Mon, 03 Aug 1998 15:05:10 +0100
Message-ID: <tics28-0308981505100001@tics28.sps.mot.com>


I have a SQLplus statement:

   select part,

          qty
   from part_list
   where part like 'a%';

It produces output like:

   part     qty
   aa         2
   ab         5
   ac         1

   etc

What I want is to add a column showing the cumulative quantity, like

   part     qty   cum
   aa         2     2
   ab         5     7
   ac         1     8

   etc

Any idea how this can be done, with Oracle 7.3 SQLplus? I know I can do it with PL/SQL but this is a second-best solution.

--
Alan Long
Materials Systems Group
Motorola, East Kilbride, Scotland
email tics28@"spam-off"email.sps.mot.com (remove the "spam-off") Received on Mon Aug 03 1998 - 09:05:10 CDT

Original text of this message

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