| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> sql syntax - use rollup ? - avg of count(1)
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?
![]() |
![]() |