//MySQL statement SELECT * FROM `MyTable` WHERE `id` IN (11,1,111) ORDER BY FIELD(`id`, 11,1,111); Laravel Framework $ids = array(1,17,2); $ids_ordered = implode(',', $itemIds); $items = static::whereIn('id', $ids)->orderByRaw(DB::raw("FIELD(id, $ids_ordered)"))->get(); The above article discusses the character sequence of mysql order by in (recommended) in detail. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Reasons and solutions for failure of dynamically added routing pages in Vue when refreshing
>>: Detailed explanation of the application of Docker Swarm in continuous integration testing
1. What is it? MySQL is the most popular relation...
1 Check whether the kernel has a tun module modin...
In Linux, the commands cat, more, and less can al...
The /partition utilization of a server in IDC is ...
Table of contents 1. Ant Design Vue 1. Official w...
Table of contents Preface know Practice makes per...
Table of contents 1. Deconstruction Tips 2. Digit...
The biggest bottleneck of using zabbix is the d...
To do a paginated query: 1. For MySQL, it is not ...
These specifications are designed to allow for bac...
In CSS, text is one of the most common things we ...
Table of contents introduction 1. What is one-cli...
When I first started, I found a lot of errors. In...
Preface: In MySQL, the system supports many chara...
1. What is a calculated attribute? In plain words...