Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql order by where condition sub query


SELECT orders.status, orders.created_at
FROM `orders`
ORDER BY
  status='new' DESC,
  status='processing' DESC,
  CASE WHEN status IN ('new', 'processing') THEN created_at END ASC,
  CASE WHEN status NOT IN ('new', 'processing') THEN created_at END DESC
  
Comment

PREVIOUS NEXT
Code Example
Sql :: postgres insert knex 
Sql :: how to user id to show in from date to upto date in mssql server 
Sql :: mysql server create connection string 
Sql :: ora 00001 in oracle 
Sql :: insert data 
Sql :: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it (SQL: select * from `featured_categories` limit 1) 
Sql :: how to install sql server 
Sql :: export data from excel to sql server 
Sql :: how to filter in sql 
Sql :: mysql order by desc 
Sql :: java.sql.sqlexception: access denied for user 
Sql :: list databases in sql server 
Sql :: sql script to delete duplicate records in a table 
Sql :: import DB through mysql console 
Sql :: can pandas fetch data from sql 
Sql :: criteria builder select subset of column 
Csharp :: messagebox yes-no 
Csharp :: c# hello world program 
Csharp :: c# replace all non numeric characters 
Csharp :: c# random number 
Csharp :: asp.net c# write string to text file 
Csharp :: c# get file size in bytes 
Csharp :: get self component in unity 
Csharp :: unity how to copy something to the clipboard 
Csharp :: c# how to simulate mouse click 
Csharp :: check last character of a string c# 
Csharp :: find closest gameobject unity 
Csharp :: xamarin button text lowercase 
Csharp :: c# read json file into object 
Csharp :: how to change scenes with button press in unity c# 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =