select * from table order by field(num,'1','2','3') desc/asc;
$query->orderByRaw(DB::raw("FIELD(num, '1', '2') desc")) //对num里面的1和2排序,可以部分排序
select * from table order by field(num,'1','2','3') desc/asc;
$query->orderByRaw(DB::raw("FIELD(num, '1', '2') desc")) //对num里面的1和2排序,可以部分排序
本文标题:laravel order by 自定义排序
本文链接:https://www.haomeiwen.com/subject/slrswxtx.html
网友评论