随笔 - 17  文章 - 0  评论 - 0  阅读 - 6958

mysql 8.0 关于group by 报错的问题

报错信息如下:

Cause: java.sql.SQLSyntaxErrorException: (conn=5097) Expression #1 of SELECT
 list is not in GROUP BY clause and contains nonaggregated column 'XXXX.id' which is not functionally dependent on columns in G
ROUP BY clause; this is incompatible with sql_mode=only_full_group_by
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: (con
n=5097) Expression #1 of SELECT list is not in GROUP BY clause and contains nona
ggregated column 'XXXX.id' which is not functio
nally dependent on columns in GROUP BY clause; this is incompatible with sql_mod
e=only_full_group_by

 

解决办法:

etc里面的文件my.cnf 中添加 sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'

并重启mysql

posted on   酸辣小甜饼  阅读(657)  评论(0编辑  收藏  举报
努力加载评论中...
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

点击右上角即可分享
微信分享提示