Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: not a GROUP BY expression
Try something like:
>SELECT choice, COUNT(choice), (COUNT(choice)/(SELECT COUNT(choice)
> FROM results
> WHERE pollid=1))*100
> FROM results
> WHERE pollid=1
> GROUP BY choice
select
res.choice , count(res.choice) , ( count(res.choice) / tot.choices ) * 100 avg_choice from ( select count(*) choices from results where pollid = 1 ) tot , results res where res.pollid = 1 group by res.choice, tot.choices
I've not tested this, but it should get you close. Received on Fri Nov 09 2001 - 09:49:21 CST
![]() |
![]() |