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: SQL Help, Please!

Re: SQL Help, Please!

From: Serge Kosourikhin <kosour_at_braz.ru>
Date: Thu, 25 May 2000 14:53:32 +0900
Message-Id: <10508.106823@fatcity.com>


Try this
SQL > select a.DateOP, sum(b.Tons) as ACC_Tons from t1 a, t1 b   where b.DateOP <= a.DateOP
  group by a.DateOP;

Serge Kosourikhin
Oracle DBA
JSC Bratsk Aluminium Plant

> Hi, Gurus, Could anyone help me with this problem(we are running on Oracle
> 7.3.4):
>
> I have a table with the following fields and data:
>
> DateOP Tons
> ------------ -------------
> 01/05/2000 4.5
> 02/05/2000 3.5
> 03/05/2000 2
> 04/05/2000 4
>
> I want to write a single SQL to achieve accumulated 'Tons' results like
> this:
>
> DateOP ACC_Tons
> ------------ -------------
> 01/05/2000 4.5
> 02/05/2000 8
> 03/05/2000 10
> 04/05/2000 14
>
> Thanks in advance.
> Jane Gao
> Senior Application Support Analyst
> Kalgoorlie Consolidated Gold Mines
> --------------------------------------------------------------------------
-
> > * Phone : (08) 9022 1129
> *Fax : (08) 9022 1149
> > *Address : PMB 27
> KALGOORLIE WA 6430
> > *E-mail : jgao_at_kalgold.com.au
Received on Thu May 25 2000 - 00:53:32 CDT

Original text of this message

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