SELECT username, (SUM(rating)/count(*)) as TheAverage, count(*) as TheCount
FROM ratings
WHERE month ='Aug' AND TheCount > 1
GROUP BY username
ORDER BY TheAverage DESC, TheCount DESC
I know that’s really close (I think) but it’s saying ‘TheCount’ doesn’t exist in the WHERE clause and the ORDER clause.
The table is:
id, username, rating, month
And I’m trying to work out the average rating for each user then order the results by average rating and number of ratings.
If you group and count, you need having: