only_full_group_by

Posted huim

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了only_full_group_by相关的知识,希望对你有一定的参考价值。

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'xxxxx' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set @@sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

vi /etc/my.cnf
添加 sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

service mysqld restart       重启mysql服务

以上是关于only_full_group_by的主要内容,如果未能解决你的问题,请参考以下文章

only_full_group_by问题

MySQL报错:sql_mode=only_full_group_by 4种解决方法含举例,轻松解决ONLY_FULL_GROUP_BY的报错问题

this is incompatible with sql_mode=only_full_group_by错误解决

MySQL sql_mode=only_full_group_by错误

在 HeidiSQL 中执行查询时与 only_full_group_by 相关的错误

mysql sql_mode=only_full_group_by 错误解析(待确认)