where id in 用order by field保持排序

select * from tables where id in (2,3,1)

        返回的数据是按id 1,2,3排序的,如果你希望返回的按照in给的顺序排序就需要用到order by field了

select * from tables where id in (2,3,1) ORDER BY field(id, 2, 3, 1)阅读全文→

标签: mysql IN 排序

chunkuan 发布于 2015-09-01 10:22