Hello friends, Today we will show Laravel query builder sum group by. Here you will show simple example of laravel select sum of column. we will provide get sum of amount, visitor etc in laravel. we will explain select sum laravel eloquent, laravel sum query with where condition and laravel select sum of column.
$data = DB::table("click")->sum('numberofclick'); print_r($data);
$data = DB::table("click") ->select(DB::raw("SUM(numberofclick) as count")) ->orderBy("created_at") ->groupBy(DB::raw("year(created_at)")) ->get(); print_r($data);
I hope you understand of laravel DB::row sum query and it can help you..