Exactly what I needed!
Steve, April 28, 2009 - 3:07 pm UTC
A fast, concise and accurate answer to my question. Perfect.
Thanks!
Adding another group by
Steve, April 28, 2009 - 3:18 pm UTC
Now my requirements have changed a bit and I need to add a "higher" group by column, then get the percentages based on the sub-total counts of that column. The answer appears to be a Partition By clause for that new column, which in effect makes the ratio_to_report function act more like "ratio_to_partition". Very cool.
select country, job, count(*),
to_char( ratio_to_report( count(*) ) over (Partition By country)*100, '999.99') ||' %'
from emp
group by country, job
order by country, job;
Thanks again!