laravel 框架数据库查询错误

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'localhost.t_test.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

如果使用group by 语法 ,需要在env 文件中设置 DB_STRICT_MODE = false ,因为laravel数据库配置文件中strict默认开启了严格模式,需要关闭同时也需要修改数据配置 sql_model 中去掉onlu_full_group_by,重启数据库就可以了

你可能感兴趣的:(mysql)