Say I have a query \"select * from clauses where id in (0,2,5,1,3)\" and I actually want the rows returned in the same order they are specified the where clause. The order of t
On MySQL, you can use FIND_IN_SET:
ORDER BY FIND_IN_SET(id, '0,2,5,1,3')
The most portable means of ordering would be to use a CASE expression:
ORDER BY CASE id WHEN 0 THEN 1 WHEN 2 THEN 2 WHEN 5 THEN 3 WHEN 1 THEN 4 WHEN 3 THEN 5 END