//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
The <abbr> and <acronym> tags represen...
I once encountered an assignment where I was give...
Summary of common operators and operators in java...
JS provides three methods for intercepting string...
In enterprises, database high availability has al...
Table of contents Preface Ajax serial and paralle...
Preface I believe many students are already famil...
Table of contents Preface Earlier iterations Iter...
Native JS implements the click number game for yo...
1. Download the MySQL installation package (there...
nginx Nginx (engine x) is a high-performance HTTP...
Table of contents 1. Introduction 2. Main text 2....
When any project develops to a certain complexity...
Table of contents Array deduplication 1 Double-la...
How to use iframe: Copy code The code is as follo...