Имеется вот такой код
$users = \DB::table('users')
->select('users.id',
'users.username',
'users.avatar',
'users.user_id',
\DB::raw('SUM(jackpot_room1.price) as top_value'),
\DB::raw('COUNT(jackpot_room1.id) as wins_count')
)
->join('jackpot_room1', 'jackpot_room1.winner_id', '=', 'users.id')
->groupBy('users.id')
->orderBy('top_value', 'desc')
->limit(20)
->get();
$place = 1;
$i = 0;
foreach($users as $u){
$users[$i]->jackpot_room1_played = count(\DB::table('jackpot_room1')
->join('room1_bets', 'jackpot_room1.id', '=', 'room1_bets.game_id')
->where('room1_bets.user_id', $u->id)
->groupBy('room1_bets.game_id')
->select('room1_bets.id')->get());
$users[$i]->win_rate = round($users[$i]->wins_count / $users[$i]->jackpot_room1_played, 3) * 100;
$i++;
}
echo $users.'<br>-------<br>'.$place;
Но при выполнение данного кода появляется ошибка
spoilerIlluminate \ Database \ QueryException (42000)
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'base.room1_bets.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select `room1_bets`.`id` from `jackpot_room1` inner join `room1_bets` on `jackpot_room1`.`id` = `room1_bets`.`game_id` where `room1_bets`.`user_id` = 101200 group by `room1_bets`.`game_id`)
Никак не могу побороть ее, подскажите пожалуйста.