Mysql in 排序

SELECT `id` FROM `topic` WHERE `id` IN ('444','512','447','509','504','445','511') ORDER BY FIELD(id,444,512,447,509,504,445,511)


SELECT `id` FROM `topic` WHERE `id` IN ('444','512','447','509','504','445','511') ORDER BY INSTR('444,512,447,509,504,445,511,', CONCAT(id,','))

posted @ 2017-04-17 13:49  朴一辰  阅读(184)  评论(0编辑  收藏  举报