Jump to content

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


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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.