mysql中order by in 的字符顺序(推荐)
程序员文章站
2022-04-06 22:52:10
...
下面小编就为大家带来一篇详谈mysql order by in 的字符顺序(推荐)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
相关mysql视频教程推荐:《mysql教程》
//MySQL 语句SELECT * FROM `MyTable`WHERE `id` IN (11,1,111) ORDER BY FIELD(`id`, 11,1,111);
laravel 框架
$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 的字符顺序(推荐)的详细内容,更多请关注其它相关文章!