Laravel group by
DB::table(ātable_nameā)->groupBy(ācolumn_nameā)->get(); is used for group by condition in laravel.
laravel group by clause Example
We are going to fetch data with groupBy clause in laravel from the table emp.
DB::table('emp')->groupBy('manager_name')->get();
Will Generate the following query.
//Select * from emp group BY āmanage_nameā ;
Advertisements