MySQL: operation of summing and division ?

Posted by Nick on Programmers See other posts from Programmers or by Nick
Published on 2012-06-25T12:59:19Z Indexed on 2012/06/25 15:22 UTC
Read the original article Hit count: 217

Filed under:
|

Alright, so I have a user table and would like to get the max value for the user with the highest amount of points divided by a score. Below is a rough idea of what I'm looking for:

SELECT MAX(SUM(points)/SUM(score)) FROM users

I'm not interested in adding up both columns and dividing, rather I'm interested in dividing the points and score for each user and retrieve the highest value out of the lot.

© Programmers or respective owner

Related posts about mysql

Related posts about syntax