简而言之,我有一个各种各样的游戏,它的计分板显示了最终玩家的得分+他们花了多长时间才达到目标.我需要对MySQL结果进行排序,以使最快的时间中最高的分数排在首位,而最慢的时间中最低的分数排在最后,并且两者之间的所有内容都以相同的方式排名.但是我不知道该怎么做,这就是我的sql:
In short, I have a game of sorts, and the score board for it shows the score of the player at the end + how long they took to achieve it. I need to order my MySQL results so that the highest score in the fastest time is first and the lowest score with the slowest time is last, and everything in between is ranked in the same way. But I have no idea how I'd do that, here's my sql as it stands:
$sql1 = "SELECT * FROM boobmatch_highscores ORDER BY t_score DESC, time ASC";任何帮助将不胜感激!
表中的数据:
Score Time 23 00:04:32 23 00:04:31 25 00:02:32 16 00:06:32 35 00:04:32 2 00:01:17 -13 00:19:32 -3 00:07:27推荐答案
您的查询应该可以正常工作.如果您有任何问题,只需将字段名称括在引号中,如下所示:
You query is supposed to work perfectly. If you have any issues just enclose the field names in quotes like so:
$sql1 = "SELECT * FROM boobmatch_highscores ORDER BY `t_score` DESC, `time` ASC";猜测它是MySQL,否则不需要引号
Guessing it's MySQL, else the quotes won't be necessary
更多推荐
MySQL按两个值排序
发布评论