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: Simple sql question, I think.

Re: Simple sql question, I think.

From: DA Morgan <damorgan_at_psoug.org>
Date: Sat, 28 Jul 2007 11:03:50 -0700
Message-ID: <1185645826.578958@bubbleator.drizzle.com>


DaLoverhino wrote:
> Is there a way to take the average of a group of averages in a sql
> statement?
>
> So for instance:
>
> select a, b, avg( c) from T group by a, b;
>
> -- That finds the average of each group a,b.
>
> Now how to take the average of those averages? I can create a view I
> suppose, but I'm curious to know if there was a way to do it without
> resorting to making a view?
>
> thanks.

That is what analytic functions were made for:

Look them up at tahiti.oracle.com and find demos you can use in Morgan's Library at www.psoug.org under Analytic Functions.

A full listing of Oracle functions and demos can be found at: http://www.psoug.org/reference/builtin_functions.html

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Sat Jul 28 2007 - 13:03:50 CDT

Original text of this message

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