Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Simple sql question, I think.
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.orgReceived on Sat Jul 28 2007 - 13:03:50 CDT