Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie SQL
How about this:
SQL> select * from myTable;
SCORE OID TYPE
---------- ---------- ----------
60 123 text 40 124 attach 37 123 attach 28 150 attach 13 123 attach
SQL> select
2 ( select sum(score) from myTable T where t.oid = t1.oid group by oid ) cumul,
3 score,
4 oid,
5 type
6 from myTable T1
7 order by oid;
CUMUL SCORE OID TYPE
---------- ---------- ---------- ----------
110 60 123 text 110 37 123 attach 110 13 123 attach 40 40 124 attach 28 28 150 attach
hope this helps
chris.
zeb wrote:
> Hi,
>
> I have the following table:
>
> SCORE OID TYPE
> -------- ------ -------
> 60 123 text
> 40 124 attach
> 37 123 attach
> 28 150 attach
> 13 123 attach
>
> What is the request to get the following: ( outer join ?? )
>
> CUMUL SCORE OID TYPE
> ----- ------ ------ -------
> 110 60 123 text
> 110 40 123 attach
> 110 37 123 attach
> 40 28 124 attach
> 28 13 150 attach
>
> where 110 = 60 + 37 + 13.
>
> Thanks in advance
>
>
Received on Thu Nov 07 2002 - 09:43:27 CST