标签:bind lock block service subquery code table select rom
源生sql
select from (select from service_order order by order_time asc) a group by a.company_id;
$subQuery = ServiceOrder::select([‘id‘, ‘company_id‘, ‘service_id‘, ‘order_time‘])
->where(‘project‘, ‘yundou‘)
->orderBy(‘order_time‘, ‘asc‘);
$sql = $subQuery->toSql();
$query = DB::table(DB::raw("({$sql}) as sub"))
->groupBy(‘sub.company_id‘);
$result = $query->mergeBindings($subQuery->getQuery())->paginate(10);
标签:bind lock block service subquery code table select rom
原文地址:http://blog.51cto.com/phpme/2308204