Detailed explanation of the order of Mysql query results according to the order of ID in in() Example code: <select id="queryGBStyleByIDs" resultMap="styleMap"> select style_num_id ,style_id,style_title,style_pic FROM gb_style where online = 1 AND is_hide = 0 and style_num_id in <foreach collection="styleNumIDs" item="styleNumId" separator="," open="(" close=")"> #{styleNumId} </foreach> ORDER BY FIELD <foreach collection="styleNumIDs" item="styleNumId" separator="," open="(style_num_id," close=")"> #{styleNumId} </foreach> </select> The final output sql is as follows: select style_num_id ,style_id,style_title,style_pic FROM gb_style where online = 1 AND is_hide = 0 and style_num_id in (1,3,2,5) order by field (style_num_id,1,3,2,5); If you have any questions, please leave a message or come to the community to discuss. Thank you for reading and I hope it can help you. Thank you for your support of this site! You may also be interested in:
|
<<: One question to understand multiple parameters of sort command in Linux
>>: Detailed explanation of CocosCreator message distribution mechanism
1. Single table query -> update UPDATE table_n...
This article shares with you the installation and...
1. Get is used to obtain data from the server, wh...
Recently, I ran a spark streaming program in a ha...
The main part of the page: <body> <ul id...
Linux builds NFS server In order to achieve data ...
Although W3C has established some standards for HT...
Table of contents need: Function Points Rendering...
The current requirement is: there is a file uploa...
Passive Check With passive health checks, NGINX a...
Table of contents 1. First, let’s explain what Re...
The first parameter passing method is dynamic rou...
Through permission-based email marketing, not onl...
This article shares with you a detailed tutorial ...
Preface In general development, images are upload...