laravel group by 时会出现 SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3

laravel group by 时会出现 SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3

SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘youkac.a.property_id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

数据库版本:5.7.14

第一种解决办法

修改mysql配置my.ini 去掉only_full_group_by 保存重启mysql

第二种修改laravel配置

config目录下面的database文件
laravel group by 时会出现 SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3把strict改为false