Jump to content

SQL/PHP to count the most popular row values? (for a top 10 list)


hatrickpatrick

Recommended Posts

making a top 10 list here... Let's say I have a list of games, say 20 of them. I have a table which is "games":

game_id

game_name

 

I have another table for people to rate the game, "game_ratings":

rating_id

rating_gameid

rating_value (Can be between 0 and 5)

 

So when I'm showing the rating for a game, I just get the average of rating_value fields for rows with that game ID.

 

If I want to have a list on the home page of the top rated games, how would I do it? Or is it even possible? I would want to basically find the game with the highest average, then the next highest, then the next, etc... Can it be done?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.