SQL – how to change the ORDER BY in a query
When it is necessary to have a predefined order in a query, it is possible to change the order of the items by using a CASE in the ORDER BY. In this example id 12 must appear before id 2. SELECT * FROM channel ORDER BY ( CASE WHEN id = 1 THEN 1 WHEN … Read more