how to apply order by on two columns in sql code example
Example 1: sql order by multiple columns
SELECT * FROM table_name ORDER BY col1 ASC; -- ASCending is default
SELECT * FROM table_name ORDER BY col1 DESC; -- DESCending
SELECT * FROM table_name ORDER BY col1 DESC, col2 ASC; -- col1 DESC then col2 ASC
Example 2: sort order on two columns sql
Sort by multiple column : ORDER BY column1 DESC, column2
Example 3: sql order by two columns
ORDER BY column1 DESC, column2