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 -> sql syntax - use rollup ? - avg of count(1)

sql syntax - use rollup ? - avg of count(1)

From: Joe Blow <zuestra_at_hotmail.com>
Date: Mon, 28 May 2001 23:55:46 -0700
Message-ID: <joh6htg2a2hcd2hhe4uss4u6118cse5ujr@4ax.com>

I start with something like -

select fk_column, count(1) from atable
group by fk_column.

I get a bunch of columns and their counts..

What I want is the average of all of them *without using report functionality* like compute avg of x on ..

So, I can do it with a subquery like

select avg(a) from
(select fk_column, count(1) a from
a table group by fk_column)

but can I do it with some variation of rollup?

select fk_column, avg(count(1)) as anaverage from sometable group by rollup (fk_column);

does not work..

any ideas? Heading down wrong path?

Received on Tue May 29 2001 - 01:55:46 CDT

Original text of this message

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