Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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
Comment

sort order on two columns sql

Sort by multiple column : ORDER BY column1 DESC, column2
Comment

sql order by two columns

ORDER BY column1 DESC, column2
Comment

Order values on multiple columns SQL

-- the ORDER BY is used to sort results in order according to the values of one or more columns:
SELECT title, release_year
FROM films
ORDER BY release_year; -- Ascending (is default)
ORDER BY release_year DESC; -- Descending, add DESC
ORDER BY release_year, title; -- add comma to order on multiple columns
Comment

SQL ORDER BY With Multiple Columns

SELECT *
FROM Customers
ORDER BY first_name, age;
Comment

PREVIOUS NEXT
Code Example
Sql :: how to run sql server on mac 
Sql :: sql server 2019 installation 
Sql :: mysql create a user 
Sql :: print hello world in sql 
Sql :: sql run multiple updates in one query 
Sql :: oracle create table primary key 
Sql :: sql create tabel with primary key auto_increment code 
Sql :: oracle parameter 
Sql :: mysql with 
Sql :: mongodb vs mysql 
Sql :: ms sql server port 
Sql :: ignore case in string sql 
Sql :: TSQL function split string 
Sql :: auto increment in postgresql 
Sql :: SQL BACKUP DATABASE for SQL Server 
Sql :: sql find leading space 
Sql :: mysql disable triggers 
Sql :: sql query inner join 3 tables 
Sql :: sql alter column name sql server 
Sql :: split string by comma in sql server 
Sql :: postgres find missing indexes 
Sql :: how to create a table based on another table in mysql 
Sql :: how to get the maximum length of a name in sql 
Sql :: how to get max from each department in sql 
Sql :: Create the connection pool mysql2 
Sql :: SQL order by string split length 
Sql :: change database postgres 
Sql :: docker hub mysql 
Sql :: postgresql variable in query 
Sql :: sql table 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =