How to group by multiple columns in Laravel Query Builder?By Hardik Savani | June 12, 2016 | | 1639 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"))
- Dynamic Autocomplete search using Bootstrap Typeahead JS Example
- Laravel 5 - Class 'Input' not found issue?
- PHP - import excel file into mysql database tutorial
- How to get current month records in Laravel 5?
- How to group by multiple columns in Laravel Query Builder?
- Laravel 5 - category treeview hierarchical structure example with demo
- Example of Cron Job in Laravel 5