How to group by multiple columns in Laravel Query Builder?By Hardik Savani | June 12, 2016 | | 21071 Viewer | Category : Laravel
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 send mail using zoho smtp server in PHP Laravel?
- How to get last inserted id in Codeigniter?
- How to create custom helper in Laravel 5?
- Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo
- How to get Ip Address in Laravel 5?
- Laravel 5 - line chart example code using google charts API
- How to redirect page using JQuery?
- How to get last record from MySQL table in Codeigniter?