I have the following table
DROP TABLE IF EXISTS `test`.`foo`;
CREATE TABLE `test`.`foo` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(
As the other answer mentions: the query you posted has nothing about what order you'd like your results, just which results you'd like to get.
To order your results, I would use ORDER BY FIELD():
SELECT * FROM foo f where f.id IN (2, 3, 1)
ORDER BY FIELD(f.id, 2, 3, 1);
The argument list to FIELD can be variable length.