Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> not a GROUP BY expression
I am trying to retrieve the results of a poll. I would like to
display the choice, the number of votes the choice received and the
percentage of the total votes the choice received. Here is the query:
SELECT choice, COUNT(choice), (COUNT(choice)/(SELECT COUNT(choice)
FROM results WHERE pollid=1))*100FROM results
When I run the query, I get the following error:
SELECT choice, COUNT(choice), COUNT(choice)/(SELECT COUNT(*)
*ERROR at line 1:
As you can see, the subquery is causing the problem. In the subquery, I'm trying to get the count of all the choices for the particular poll. I then want to divide the count of the current choice by the total number of choices. Any thoughts on how to get around this problem? Please respond to kilmer_at_isomedia.com as well as to the group. I sometimes have trouble with the newgroups. Thanks. Received on Thu Nov 08 2001 - 16:53:30 CST
![]() |
![]() |