We can specify multiple columns in the ORDER BY clause to get sorted output based on these multiple columns. The following is an example to make this concept clearer -
mysql> Select * from Student ORDER BY Name, Address; +------+---------+---------+-----------+ | Id | Name | Address | Subject | +------+---------+---------+-----------+ | 2 | Aarav | Mumbai | History | | 1 | Gaurav | Delhi | Computers | | 15 | Harshit | Delhi | Commerce | | 17 | Raman | Shimla | Computers | +------+---------+---------+-----------+ 4 rows in set (0.12 sec)
The above is the detailed content of How can we get sorted output based on multiple columns?. For more information, please follow other related articles on the PHP Chinese website!