Ordering mySQL results by two fields
Posted: Sat Oct 24, 2009 6:02 pm
I am wanting to order games on my website in order of the highest rated. My database is something like this:
Game.....Rating.....Number of Votes
game1....4...........7
game2....5...........1
game3....2...........83
game4....5...........7
But if I order by rating game2 would come before game4 but I would like game4 to come before game2 because it is still rated 5/5 but has had more votes. I have tried a few different ways to do this but can't seem to figure it out? I am currently using "ORDER BY Rating DESC".
Thanks alot.
Tom.
Game.....Rating.....Number of Votes
game1....4...........7
game2....5...........1
game3....2...........83
game4....5...........7
But if I order by rating game2 would come before game4 but I would like game4 to come before game2 because it is still rated 5/5 but has had more votes. I have tried a few different ways to do this but can't seem to figure it out? I am currently using "ORDER BY Rating DESC".
Thanks alot.
Tom.