這是我的查詢,它適用於所有舊版本。Laravel groupBy not working,version 5.4.24
$data = DB::table('applicant')
->groupBy('AppAffID')
->get();
的錯誤,我得到的是:
SQLSTATE[42000]: Syntax error or access violation: 1055 'comloant_loantreeAPI.applicant.AppID' isn't in GROUP BY (SQL: select * from `applicant` group by `AppAffID`)
我已經試過了數據庫的變化:
我說 '嚴'=>假,數據庫配置。
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
你能告訴數據庫配置文件? – Teun
@Teun,我加了 – ALCHI
你確定你使用的是mysql嗎?更改配置後,你清除了配置緩存? 'php artisan config:clear' – Teun