Sort the rows according to the order specified in WHERE IN clause

You should use “ORDER BY FIELD“. So, for instance:

SELECT * FROM table WHERE id IN (118,17,113,23,72) 
ORDER BY FIELD(id,118,17,113,23,72)

Leave a Comment