码迷,mamicode.com
首页 > 数据库 > 详细

1140 In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'football.order.id'; this is incompatible with sql_mode=only_full_group_by

时间:2020-03-09 18:18:35      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:express   _for   date   mode   group   tps   sub   session   报错   

mysql5.7执行sql语句报错:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column ‘football.order.id‘; this is incompatible with sql_mode=only_full_group_by

找了好久找到可行的办法分享下



1.方法1,需要重启mysql服务





编辑/etc/my.cnf文件,加入如下参数,重启mysql

sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"

技术图片



2.方法2,不需要重启mysql服务





可以看到模式为only_full_group_by

mysql>show variables like ‘%sql_mode‘;



mysql> show session variables like ‘%sql_mode%‘;

mysql> show global variables like ‘%sql_mode%‘;





使当前会话失效

mysql> set global sql_mode=‘‘;

mysql> set session sql_mode=‘‘;

1140 In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'football.order.id'; this is incompatible with sql_mode=only_full_group_by

标签:express   _for   date   mode   group   tps   sub   session   报错   

原文地址:https://www.cnblogs.com/sunwk/p/12449853.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!