下面小編就為大家帶來一篇詳談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 的字元順序(推薦)的詳細內容。更多資訊請關注PHP中文網其他相關文章!