SQL中IN语句排序功能
由于在sql中使用in语句会自动将搜索结果排序,不适用排序的话需要增加函数
google一番后,发现有一个简单的函数:find_in_set:
SELECT * FROM `table` WHERE `id` IN (3,2,1,4) ORDER BY find_in_set(`id`, "3,2,1,4")
SELECT * FROM `table` WHERE `id` IN (3,2,1,4) ORDER BY find_in_set(`id`, "3,2,1,4")