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

Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie SQL

Re: Newbie SQL

From: Christopher Beck <christopher.beck_at_oracle.com>
Date: Thu, 07 Nov 2002 10:43:27 -0500
Message-ID: <bXvy9.2$x86.38@news.oracle.com>

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

Original text of this message

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