十、SELECT list is not in GROUP BY clause and contains

解决办法:

1.查询mysql 相关mode

select @@global.sql_mode;
可以看到模式中包含了ONLY_FULL_GROUP_BY只要没有这个配置即可
我的Mysql版本是5.7.21,默认是带了ONLY_FULL_GROUP_BY模式。
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

2.重设模式值

set @@global.sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION;

3.重启Mysql即可


作者:皮蛋瘦肉
来源:CSDN
原文:https://blog.csdn.net/u011676300/article/details/79564446
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(十、SELECT list is not in GROUP BY clause and contains)