How to group by multiple columns in Laravel Query Builder?By Hardik Savani | June 12, 2016 | | 3474 Viewer | Category : Laravel
Share this post:
Sometimes we may require to add group by with multiple columns, if we have mysql query then we can do it easily by using sql query. But if you want to give multiple columns in groupBy() of Laravel Query Builder then you can give by comma separated values as bellow example.
$data = DB::table("items_count")
,DB::raw("SUM(items_count.quantity) as total_quantity"))
- How to create custom facade in laravel 5.2?
- laravel 5.4 New Feature - Add eloquent whereKey method
- Angularjs Simple Datepicker directive example code with Demo
- Laravel 5 - Simple user access control using Middleware
- Laravel 5 - GEO chart example and demo using lavacharts package
- Laravel 5.2 chat message module using socket.io, redis, express and nodejs from from scratch.
- Laravel 5 - Implementing datatables tutorial using yajra package
- Response download with file in Laravel 5.3 example