让mysql返回的结果按照传入的id的顺序排序

比如id为 1,3,5,44,66,32,21,6 那么返回的结果顺序也是这个顺序
 
$sql = "select * from ".$this->tableName()." where id in ($ids) order by field(id, ".$ids.") ";

posted on 2017-07-10 17:47  dongruiha  阅读(2580)  评论(0编辑  收藏  举报

导航