MySQL 查询 ORDER BY 某些值先于其他值
我正在开发一个游戏高分,其中完成时间存储在数据库中,但是如果您没有完成关卡但保存了高分,则完成时间为 0。
我正在尝试进行一个查询,其中列出了高分首先是最低完成时间,但我的简单 ORDER BY
当然是在开始时保留所有 0 完成时间!
有什么办法可以这样订购,但底部有 0。
我尝试过:
从高分中选择 ORDER BY 完成时间 > 0,completiontime = 0 ASC
有人有什么想法吗?
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.
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!
Is there any way I can order it like this, but have the 0's at the bottom.
I have tried:
SELECT FROM highscores ORDER BY completiontime > 0, completiontime = 0 ASC
Anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)