select * from table where id in (5,1,8) Where in 按条件顺序排序 select * from table where id in (5,1,8) order by field(id, 5, 1 ,8)