数据库结构
通过IN取出结果
SELECT * FROM `cpl_car_brand` where id in(3,1,5,9)
结果排序默认是按ID 1,3,5,9 排序,而不是我们想要的3,1,5,9.
我们需要按IN的顺序来排,可用以下两种方法
1、order by substring_index
2、order by find_in_set
yuliang8 2017-04-28 13:13 原文
数据库结构
通过IN取出结果
SELECT * FROM `cpl_car_brand` where id in(3,1,5,9)
结果排序默认是按ID 1,3,5,9 排序,而不是我们想要的3,1,5,9.
我们需要按IN的顺序来排,可用以下两种方法
1、order by substring_index
2、order by find_in_set