Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL Help, Please!
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
![]() |
![]() |