Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql order by case

select 
  `orders`.* 
from 
  `orders` 
order by 
  CASE WHEN orders.status = 11 THEN 999999999 WHEN orders.status = 20 THEN 999999998 ELSE orders.id END DESC
Comment

PREVIOUS NEXT
Code Example
Sql :: SQL: merging multiple row data in string 
Sql :: show data in table postgres 
Sql :: postgresql default value boolean 
Sql :: tsql row number 
Sql :: sql create index 
Sql :: postgresql drop table 
Sql :: drop foreign key mysql 
Sql :: sql rank 
Sql :: sql values not in another table 
Sql :: postgres set default schema 
Sql :: create index concurrently postgres 
Sql :: mysql check if not null 
Sql :: date format in sql 
Sql :: order by oracle 
Sql :: join update query in sql 
Sql :: round one decimal place mysql 
Sql :: select and condition in sql 
Sql :: drop table with constraints 
Sql :: SQL Remove Index From Tables 
Sql :: permission denied postgres copy csv command line 
Sql :: copy table postgres 
Sql :: mysql add column with default value 
Sql :: lowest salary in sql 
Sql :: enable sql server full text indexing 
Sql :: like in mysql 
Sql :: delete join select from one table based on multiple values 
Sql :: condition in count sql 
Sql :: sqlite indexes 
Sql :: oracle log files 
Sql :: does insert into overwrite sql 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =