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

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 sql average 
Sql :: sql full outer join with where clause 
Sql :: insert query in sql 
Sql :: const pool = mysql.createpool() 
Sql :: How to find string in substring in sql server 
Sql :: mysql get max value and id 
Sql :: Assign value to variable inside Dynamic SQL 
Sql :: smallint sql 
Sql :: postgresql newline character 
Sql :: oracle show errors 
Sql :: sql join 
Sql :: how to duplicate mysql table 
Sql :: how to import mysql database command line 
Sql :: sql insert into select 
Sql :: mysql updating multiple column values from array variable 
Sql :: count in sql 
Sql :: change column name sql 
Sql :: sql group by example 
Sql :: mysql decimal 
Sql :: postgresql port 5432 not open 
Sql :: alter table query in mysql 
Sql :: Drop check constraint in ms sql 
Sql :: when matched in sql server 
Sql :: add column mysql with foreign key 
Sql :: mysql sort asc numeric 
Sql :: SQL INNER JOIN With Three Tables 
Sql :: mysql sublime build system 
Sql :: mysql workbench download 
Sql :: how to limited number of rows in db2 select * from imglib FETCH FIRST 20 ROWS ONLY 
Sql :: how to join multiple table in mysql 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =