Expression #2 of SELECT List is not in GROUP BY clause and contains
nonaggregated column ‘a.ID’ which is not functionally
dependent on columns in GROUP BY clause; this is incompatible with
sql_mode=only_full_group_by
MysqL 5.7.5及以上功能依赖检测功能。如果启用了ONLY_FulL_GROUP_BY sql模式(默认情况下),MysqL将拒绝选择列表,HAVING条件或ORDER BY列表的查询引用在GROUP BY子句中既未命名的非集合列,也不在功能上依赖于它们。(5.7.5之前,MysqL没有检测到功能依赖关系,默认情况下不启用ONLY_FulL_GROUP_BY。有关5.7.5之前的行为的说明,请参见“MysqL 5.6参考手册”。)
解决方法select @@global.sql_mode
结果为
ONLY_FulL_GROUP_BY,STRICT_TRANS_tableS,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_divISION_BY_ZERO,NO_auto_CREATE_USER,NO_ENGINE_SUBSTITUTION
执行
set @@global.sql_mode=’STRICT_TRANS_tableS,NO_ENGINE_SUBSTITUTION’;
成功解决
总结以上是内存溢出为你收集整理的mySql中Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题全部内容,希望文章能够帮你解决mySql中Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)