MySQL Query ORDER BY某些值先于其他 [英] MySQL Query ORDER BY certain values before others
本文介绍了MySQL Query ORDER BY某些值先于其他的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发游戏最高分,其中完成时间存储在数据库中,但是如果您未完成关卡但保存了最高分,则完成时间为0.
I am developing a game highscore where the time of completion is stored in a database, but if you don't complete the level but save your highscore, the completion time is 0.
我正在尝试进行一个查询,该查询首先列出了完成时间最短的高分,但是我简单的ORDER BY
在课程开始时就将所有0个完成时间都保留了下来!
I am trying to make a query which lists the highscore with the lowest completion time first, but my simple ORDER BY
is sticking all of the 0 completion times at the start of course!
有什么办法可以像这样订购它,但底部有0.
Is there any way I can order it like this, but have the 0's at the bottom.
我尝试过:
SELECT FROM highscores ORDER BY completiontime > 0, completiontime = 0 ASC
有人有什么主意吗?
推荐答案
SELECT *
FROM highscores
ORDER BY completiontime = 0, completiontime
这篇关于MySQL Query ORDER BY某些值先于其他的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文