如何根据IN
中的id对ORDER BY id进行排序SELECT *
FROM mall
WHERE mall_id IN (3331083,33310110,3331080,33310107,33310119,3331410)
AND mall_status='1' LIMIT 50
结果应该是:
答案 0 :(得分:6)
您需要FIELD功能:
SELECT * FROM mall
WHERE mall_id IN (3331083,33310110,3331080,33310107,33310119,3331410)
AND mall_status='1'
ORDER BY
FIELD(mail_id, 3331083,33310110,3331080,33310107,33310119,3331410)
LIMIT 50