如何按特定列排序MySQL查询? [英] How to order a MySQL query by a specific column?
本文介绍了如何按特定列排序MySQL查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在这里有一个查询,我正在尝试按等级"列对它们输出的顺序进行排序,我到底要添加些什么才能做到这一点?这是我的代码:
i have a query here, and I am trying to sort the order they output by the column "rank", what would i add to my query exactly to do this? here is my code:
$query = $pdo->prepare('SELECT *
FROM leaderboards
WHERE game_id=2 AND mode_id=1 and map_id=15
LIMIT 0, 100');
推荐答案
如果要按特定列排序,请使用ORDER BY
子句.
If you want to order by a specific column, use the ORDER BY
clause.
$query = $pdo->prepare('SELECT *
FROM leaderboards
WHERE game_id=2 AND mode_id=1 and map_id=15
ORDER BY rank
LIMIT 0, 100');
这篇关于如何按特定列排序MySQL查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文