Order Multiple Columns Inside phpMyAdmin

Print Friendly, PDF & Email

There may come a time when you will need to display rows in your database ordered with multiple columns.

Let’s say you have ColumnYear and ColumnMonth. You want to order first by ColumnYear, then by ColumnMonth in ascending order.

Go to the SQL tab and enter in this query:

SELECT *
FROM `TableName`
ORDER BY `TableName`.`ColumnYear`, `TableName`.`ColumnMonth` ASC
LIMIT 0 , 30

You may want to change the limit depending on how many rows you’d like to display at once.

Click on the Go button and you are done!

No comments yet.

Leave a Reply