Mysql 中 查询结果顺序按 IN 关键字中ID 的排列
SELECT *
FROM items
WHERE item_id
IN ( 2, 1, 3, 9, 7 )
ORDER BY FIELD
( item_id, 2, 1 ,3 ,9 , 7 )
本文来自投稿,不代表本站立场,如若转载,请注明出处:https://www.unfit.cn/archives/61.html
SELECT *
FROM items
WHERE item_id
IN ( 2, 1, 3, 9, 7 )
ORDER BY FIELD
( item_id, 2, 1 ,3 ,9 , 7 )