where id in用 order by field 保持排序
转载自http://blog.linuxphp.org/archives/1588/
先看下mysql的默认排序
select id from article where id in(63261,63262,63269);
+-------+
| id |
+-------+
| 63261 |
| 63262 |
| 63269 |
+-------+
如果我想63262在第一个63261在最后一个怎么办?
select id from article where id in(63261,63262,63269) order by field(id,63262,63269,63261);
+-------+
| id |
+-------+
| 63262 |
| 63269 |
| 63261 |
+-------+
坚持!