MySQL ORDER BY IN()

I think you may be looking for function FIELD — while normally thought of as a string function, it works fine for numbers, too!

ORDER BY FIELD(field_name, 3,2,5,7,8,1)

Leave a Comment