Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Q getting a Percentage of a total.........?
Hi,
Can you try something like this...
select
t2.DESC,
round(((count(t1.PURPOSE)/sum.summe)*100) ) Pct_Of_Total,
round((avg(t1.PRICE)),0)
from
t_1 t1,
t_2 t2,
(select count(*) summe from t1 where ...) sum
where...
Dirk
"Mike Cohen" <mcohen_at_attbi.com> schrieb im Newsbeitrag
news:9a742dd3.0212061445.7c4c1f52_at_posting.google.com...
> Hello Everyone,
>
> I've been banging my head with this problem and was hoping someone
> here could help out.
>
> I have the following query:
>
> select
> t2.DESC,
> round(((count(t1.PURPOSE)/18175)*100) ) Pct_Of_Total,
> round((avg(t1.PRICE)),0)
> from
> t_1 t1,
> t_2 t2
> ...
>
> The problem I'm having is that I want where I have 18175 in my select
> to be a full count of t1.PURPOSE - sum of all the counts if you will.
> The number 18175 is the full count, yet I don't want it hardcoded in.
> I've tried:
>
> *sum(count(t1.purpose)) but this bombs on Group By errors...
> *searching OTN as well as various manuals...
> *searching the google archives...
>
> all with no real success.
>
> Does anyone have any ideas?
>
> Thanks in advance...
>
> Mike
Received on Mon Dec 09 2002 - 01:53:16 CST