0
点赞
收藏
分享

微信扫一扫

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GR

登高且赋 2022-04-29 阅读 48

项目场景:

sql报错:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘xx’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by


原因分析:

高版本sql5.7及以上默认sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

包含ONLY_FULL_GROUP_BY


解决方案:

在windows下,打开mysql安装目录,打开bin目录下的my.ini

加上:

[mysqld]

sql-mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

举报

相关推荐

0 条评论