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 :: oracle avg 
Sql :: sql delete 
Sql :: pgadmin see indexes 
Sql :: oracle create package body 
Sql :: sqlalchemy bulk delete 
Sql :: Expression number 1 of select list is not in group by clause 
Sql :: ms sql print more than 1 variable 
Sql :: add foreign key to existing table 
Sql :: sqlite 3 mac 
Sql :: SQL Error [42501]: ERROR: permission denied for table 
Sql :: oracle inner join 
Sql :: update sql sintax 
Sql :: truckat table mysql 
Sql :: insert select 
Sql :: sql view index 
Sql :: delete table in mysql 
Sql :: install mysql in ubuntu 18.04 
Sql :: copy a table mysql 
Sql :: decimal() mysql 
Sql :: mysql 5.6 hierarchical recursive query 
Sql :: sqlite modify row 
Sql :: sql query to return field name of a table 
Sql :: match in sql server 
Sql :: sql server select rows by distinct column 
Sql :: pl sql auto increment 
Sql :: sql order of operations 
Sql :: oracle cpu metric 
Sql :: time in sql server 
Sql :: how to delete python anywhere mysql database 
Sql :: mssql coalesce 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =