Answers for "sql order by two columns"

SQL
4

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
Posted by: Guest on May-17-2020
7

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;		-- col1 DESC then col2 ASC
Posted by: Guest on May-09-2021
5

sort order on two columns sql

Sort by multiple column : ORDER BY column1 DESC, column2
Posted by: Guest on March-03-2020
2

sql order by two columns

ORDER BY column1 DESC, column2
Posted by: Guest on December-09-2020

Code answers related to "sql order by two columns"

Code answers related to "SQL"

Browse Popular Code Answers by Language