Faktisk er dette bedre:
SELECT * FROM your_table
WHERE id IN (5,2,6,8,12,1)
ORDER BY FIELD(id,5,2,6,8,12,1);
her er FIELD-dokumentationen:
http://dev.mysql.com/doc /refman/5.0/da/string-functions.html#function_field
Faktisk er dette bedre:
SELECT * FROM your_table
WHERE id IN (5,2,6,8,12,1)
ORDER BY FIELD(id,5,2,6,8,12,1);
her er FIELD-dokumentationen:
http://dev.mysql.com/doc /refman/5.0/da/string-functions.html#function_field