MySQL group by 问题
SELECT list is not in GROUP BY clause and contains nonaggregated column 'xxx' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
修改sql配置文件的sql_modej即可解决问题
1.查询本机的sql_mode(因为其他大佬的配置文件可能和你自己的不同,导致一系列问题,反正我是遇到了)
进入mysql,select @@sql_mode
复制sql_mode的内容
2.退出mysql服务
windows:net stop mysql
linux:service mysql stop
3.进入配置文件
windows:安装目录下的 my.init
linux:默认在 /etc/my.cnf
4.设置sql_mode
在[mysqld]下添加 sql_mode="第一步中复制的内容"(且删除ONLY_FULL_GROUP_BY),保存后退出
5.启动mysql服务即可成功
windows:net start mysql
linux:service mysql start

浙公网安备 33010602011771号