MySQL never ceases to amaze me… and this may magnify lack of grasp on technical stuff but here goes..
Recently I needed to return some ids’ in a certain order, and I realize I have never done that … after some digging behold the “ORDER BY FIELD”
SELECT id
FROM some_table
WHERE id in (13,5,20,7)
ORDER BY FIELD(id,5,20,13,7);
Ofcourse there are always more than one way to skin a cat … so I present the “FIND IN SET”.
SELECT id
FROM some_table
WHERE id in (13,5,20,7)
ORDER by FIND_IN_SET(id,"5,20,13,7");
Cool !