Reputation: 65
Basically, if two people have the same score in my game, the person who is in the first position on the leaderboard is whichever score / record is the newest.
How can I change my query so that if two or more people have the same score, it then sorts by name alphabetically and puts that score on the top. My query is:
$result = mysql_query("SELECT * FROM test ORDER BY Score DESC");
Upvotes: 0
Views: 25
Reputation: 181037
Just order by both in preference order;
SELECT * FROM test ORDER BY Score DESC, Name ASC
Upvotes: 2