I have come up with another question.I am trying to devise a MySql query.
I have a Users table and a Ratings table with user_id as a foreign key in ratings table.
Now I have to get the user who has maximum average ratings
So I did:
SELECT blah blah FROM Users USR
INNER JOIN Ratings RTN on USR.id = RTN.user_id
order by avg(RTN.rating)
But i feel this is wrong and its also not working either.Is there a way to get users ordered by average ratings they received in a descending order?
Regards
Himanshu Sharma.
Your query doesn’t seem very wrong actually (as a start), I would write it like this: