On Tue, 24 Apr 2007, Penchalaiah P. wrote:

> Hi
>
> I have the data like this in temp table
>
> SQL> Select sno, value from temp;
>
> SNO                           Value
>
> 1                     650.00
>
> 2                     850.00
>
> 3                     640.00
>
> 3                     985.00
>
> 5                     987.00
>
> 9                     9864.00
>
> 7                     875.00

Tables are not ordered.  You'll need something like an ordering column
that represents the ordering and is unique.

Then you can probably do something like (untested):
 select sno, value, (select sum(value) as sum from temp t where t.ordering
 <= temp.ordering) from temp order by ordering;
or
 select t1.sno, t1.value, sum(t2.value) from temp as t1, temp as t2 where
 t1.ordering >= t2.ordering group by t1.ordering, t1.sno, t1.value order
 by t1.ordering;

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to