Q:

SQL complex sorting by two columns

I want to use SQL to get the the 5 "best" rated profiles. The problem is, I do not want the ranking solely based on grades. 
Say there is a profile with a grade 8.1, but with 5 reviews I want it to be so that a profile with a grade 7.9 and 30 reviews will be ranked higher. 
How can I accomplish that if the grade is a maximum of .3 lower than another but with a minimum of 30% reviews higher is listed higher than the other?
This is my query now: (average = grade, reviews = number of reviews)
 SELECT name,reviews,average 
 FROM profiles 
 WHERE average >= 7 
    AND reviews >= 50 
 ORDER BY average  DESC, reviews DESC 
 LIMIT 5

A:

You could do a similar calculation in the ORDER BY clause. I'll keep trying to see if I can get exactly what you're going for, but to start, you could weight your sorting something like this.
SELECT name,reviews,average 
FROM profiles 
WHERE average >= 7 
   AND reviews >= 50 
ORDER BY (average*.7 + reviews*.3) 
LIMIT 5

