How to order a MySQL query by a specific column?

前端 未结 2 1237
半阙折子戏
半阙折子戏 2021-01-29 13:04

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:

$que         


        
2条回答
  •  自闭症患者
    2021-01-29 13:48

    you even can use more that one field to sort, See below

    $query = $pdo->prepare('SELECT * 
                            FROM leaderboards 
                            WHERE game_id=2 AND mode_id=1 and map_id=15 
                            ORDER BY rank, rank2
                            LIMIT 0, 100'); 
    

提交回复
热议问题