MySQL分组查询时出现错误SELECT list is not in GROUP BY ;this is incompatible with sql_mode=only_full_group_by

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

解决方法:

修改MySQL的配置文件

vi /etc/mysql/my.cnf

添加语句sql_mode='NO_ENGINE_SUBSTITUTION'

然后重启数据库 /etc/init.d/stop    /etc/init.d/start



你可能感兴趣的:(MySQL分组查询时出现错误SELECT list is not in GROUP BY ;this is incompatible with sql_mode=only_full_group_by)