order by multiple columns in sql code example
Example 1: order by with more than one column
The following shows that you can perform order by with more
than one column.
'ASC' denotes ascending sort order, but is optional as it is the default sort order.
'DESC' denotes descending sort order
SELECT Id, CompanyName, City, Country
FROM Supplier
WHERE Country IN ('USA', 'Japan', 'Germany')
ORDER BY Country ASC, CompanyName DESC
Example 2: multiple order by sql
ORDER BY column1 DESC, column2
Example 3: sql order by multiple columns
SELECT * FROM table_name ORDER BY col1 ASC;
SELECT * FROM table_name ORDER BY col1 DESC;
SELECT * FROM table_name ORDER BY col1 DESC, col2 ASC;
Example 4: sort order on two columns sql
Sort by multiple column : ORDER BY column1 DESC, column2
Example 5: order by multiple columns
ORDER BY column1 DESC, column2