Order items in MySQL by a fixed list?
You can do that by using either:
ORDER BY FIND_IN_SET(id, '3,11,7,1')
or
ORDER BY FIELD(id, 3, 11, 7, 1)
or
ORDER BY CASE id WHEN 3 THEN 0
WHEN 11 THEN 1
WHEN 7 THEN 2
WHEN 1 THEN 3
ELSE 4
END