1
2SELECT orders.status, orders.created_at
3FROM `orders`
4ORDER BY
5 status='new' DESC,
6 status='processing' DESC,
7 CASE WHEN status IN ('new', 'processing') THEN created_at END ASC,
8 CASE WHEN status NOT IN ('new', 'processing') THEN created_at END DESC
9