Web Hosting Talk







View Full Version : math in sql


ti_nhatrang
09-13-2007, 04:45 AM
Hi guys,

I have a little problem, maybe a major one, but if you can help me nail down what I'm doing wrong, it would be greatly appreciated.

I have three columns: Names, Votes and Scores, I basically want to pull out the highest average scores with the names. here is what I got:


select * from voting order by scores / votes limit 1

kuldeeps
09-13-2007, 12:14 PM
This should work for you:

select
scores/votes as average,
name
from
voting
order by
average
limit 1