Closed
Description
I'm not sure this is standard SQL or not. but this is useful when using MySQL.
SELECT *
FROM mytable
WHERE id IN (3,2,1,4)
ORDER BY FIELD(id,3,2,1,4)
or other database like MSSQL
SELECT *
FROM mytable
WHERE id IN (3,2,1,4)
ORDER BY
CASE id
WHEN 3 THEN 1
WHEN 2 THEN 2
WHEN 1 THEN 3
WHEN 4 THEN 4
END
the above cases supported?
Metadata
Metadata
Assignees
Labels
No labels