《Mysql实例详谈mysql order by in 的字符顺序(推荐)》要点:
本文介绍了Mysql实例详谈mysql order by in 的字符顺序(推荐),希望对您有用。如果有疑问,可以联系我们。
//MySQL 语句SELECT * FROM `MyTable`WHERE `id` IN (11,1,111) ORDER BY FIELD(`id`, 11,1,111);
laravel 框架MYSQL教程
$ids = array(1,17,2); $ids_ordered = implode(',', $itemIds); $items = static::whereIn('id', $ids)->orderByRaw(DB::raw("FIELD(id, $ids_ordered)"))->get();
以上这篇详谈mysql order by in 的字符顺序(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持维易PHP.MYSQL教程
转载请注明本页网址:
http://www.vephp.com/jiaocheng/1084.html