1、数据库设计的status状态时0是刚申请1是审核过2是拒绝审核 但是现在要按照 拒绝审核、刚申请、 审核过这种排序方式排序 那就是2,0,1的排序方式排序 order by status desc asc 肯定都不行 通过查询资料找到
select * from order o ORDER BY field(o.status,‘2’,‘0’,‘1’)(o.type,‘1’,‘0’,‘2’)中to.status是要排序的字段
1、数据库设计的status状态时0是刚申请1是审核过2是拒绝审核 但是现在要按照 拒绝审核、刚申请、 审核过这种排序方式排序 那就是2,0,1的排序方式排序 order by status desc asc 肯定都不行 通过查询资料找到
select * from order o ORDER BY field(o.status,‘2’,‘0’,‘1’)(o.type,‘1’,‘0’,‘2’)中to.status是要排序的字段