//先group分组
$sql = BlindBox::selectRaw('any_value(id) as id, any_value(business_id) as business_id,project_id,SUM(access_count) as access_count,SUM(join_count) as join_count,SUM(share_count) as share_count')->groupBy('project_id');
//然后from 查询排序
$list = BlindBox::with(['project','business'])
->from(DB::raw("({$sql->toSql()}) as inv"))
->orderBy('inv.business_id');
Laravel 如何 groupBy 之后进行Order 排序
最新推荐文章于 2023-02-20 15:25:42 发布