How to group by multiple columns in Laravel Query Builder?By Hardik Savani | June 12, 2016 | | 2074 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"))
- PHP - I Can't get the $_POST Values on Ajax Request
- How to get latitude longitude from mysql in laravel 5?
- Solved - fatal: Failed to connect to bitbucket.org port 443: Network is unreachable
- Response download with file in Laravel 5.3 example
- Laravel 5 database backup using Laravel Backup Package
- How to define Global Variables in Laravel 5?
- Mysql Hexadecimal color code store in binary datatype.
- Display preview selected image in input type file using JQuery