View Single Post
Old 11-28-2007, 07:41 PM   #2 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

You need to COUNT(*) all the choices that pertain to the poll_id you're after. Say you've got a total of 9 votes, take the 9 and store it. Then get all the options you have, COUNT them individually whilst using GROUP BY on the option they can select.

So if you have 5 yes, and 4 no, making a total of 9. You would do it like this (in pseudo form):

Code:
GET YES = 5
GET NO = 4
GET TOTAL = 9
GET PERCENT YES = 5 * 100 / 9
GET PERCENT NO = 4 * 100 / 9
Like you, I'm no good at maths. I have to nip out now but there's the theory. I hope someone helps you out properly, or at least I will when I return!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following 2 Users Say Thank You to Wildhoney For This Useful Post:
CMellor (11-30-2007), ReSpawN (12-03-2007)