DB::enableQueryLog();
$last_month_cost = DB::table('ds_dwb_game_summary')
->where("userid","in",$tuple_uid)
->whereRaw("ds>={$start} and ds<= {$end}")
->sum('cost');
dd(DB::getQueryLog());
這樣就可以看到所有的查詢情況
DB::enableQueryLog();
$last_month_cost = DB::table('ds_dwb_game_summary')
->where("userid","in",$tuple_uid)
->whereRaw("ds>={$start} and ds<= {$end}")
->sum('cost');
dd(DB::getQueryLog());
這樣就可以看到所有的查詢情況
$list = DB::table('posts') ->groupBy('user_id') ->selectRaw('user_id,sum(views) as total_views')