Laravel Group By Date with Multiple Column Sum Example

Sometimes, we have date column and we wanted to get group by with date with sum of some specific column. However, we can do it using mysql DATE_FORMAT() function. Also you can use DB raw with mysql function and get group by date records. We can use this function with laravel 6, laravel 7 and laravel 8 version.

In this laravel group by date and sum example i will share source code with you. I will do sum of some specific column with groupby with date. If you don't know  example of laravel group by date and sum example, then this example is for you.

Let’s see the example of group by date in laravel eloquent example.

//Date wise sell
Route::get('/sells/all', function () {
	$report = DB::table('invoice_details')->select(
                  DB::raw('SUM(selling_price) as selling_price'),
				  DB::raw('SUM(profit) as profit'),
                  DB::raw('SUM(selling_qty) as selling_qty')
	return $report;


Read also: How to get month name from date in Laravel


Hope it can help you.


Facebook Github
A web enthusiastic, self-motivated Full-Stack Web Developer from Dhaka, Bangladesh with experience in developing applications using Laravel Vue and React Js Application.