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: analytic functions vs subquery

Re: analytic functions vs subquery

From: Jaap W. van Dijk <j.w.vandijk.removethis_at_hetnet.nl>
Date: Sat, 26 Feb 2005 12:19:29 +0100
Message-ID: <spm021ddbn8b19h4pj22bq151rg2ofoigk@4ax.com>


On Fri, 25 Feb 2005 12:34:53 +0100, Cris Carampa <cris119_at_operamail.com> wrote:

>Hello, let's suppose I have this denormalized table:
>
> ID NUM
>---------- ----------
> 1 7
> 1 7
> 1 7
> 2 9
> 3 9
> 4 3
> 4 3
>
>I wish to sum the NUM values but I wish to take just one NUM for each
>distinct ID value, e.g.:
>
>7+9+9+3
>
>I'm trying to find a way to do that using analytic functions instead of
>a subquery. Any hints?
>
>(of course select distinct(num) is not an option here)
>
>Thank you. Kind regards,

Apart from the answers given by others, on a more general note: there's a lot a aggregating going on in your problem. Do you know that analytic functions do not provide for this? You get an output row for every input row.

Jaap. Received on Sat Feb 26 2005 - 05:19:29 CST

Original text of this message

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