MySQL-Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre

2021/12/10 2:17:34

本文主要是介绍MySQL-Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Expression #1 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

解决方案

  • 先使用 SQL 查询
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

  • 此时去掉ONLY_FULL_GROUP_BY,然后重新设置值(引号中填写裁剪后的字符串
set @@global.sql_mode='';


这篇关于MySQL-Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程