需求
一个表字段叫status,值是1,2,3,4,5,6,7,8,9
project manager想进行分类,然后某一类的排序规则是按照status 1,5,3,4 排序,相同状态的按时间排序
实现SQL
select demo_id,status,create_time from demo_table
where userId='123456' and status in (1,5,3,4)
order by field(status,1,5,3,4), demo_id desc
limit 0,30;
+----+-------------+----------------[......]