用到GROUP BY 语句查询时com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'col_user_6.a.START_TIME' 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 = ''; 把sql_mode 改成非only_full_group_by模式。验证是否生效 SELECT @@GLOBAL.sql_mode 或 SELECT @@sql_mode
解决办法下my.cnf中添加以下几行
[mysqld]
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,
NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
解决MySQL only_full_group_by错误
本文介绍了解决MySQL查询时出现的only_full_group_by错误的方法。通过调整sql_mode配置,可以有效避免因非聚合列不在GROUP BY子句中而导致的异常。文中提供了具体的设置示例。
105

被折叠的 条评论
为什么被折叠?



