问题:
在mysql5.7以上的版本中,对于 group by 的这种聚合操作,如果在select 中的列,没有在group by 中出现,那么这个SQL是不合法的,因为列不在group by的从句中,所以对于设置了这个mode的数据库,only_full_group_by:使用这个就是使用和oracle一样的group 规则, select的列都要在group中,或者本身是聚合列(SUM,AVG,MAX,MIN) 才行。
使用 SQL 语句可以查询这个配置

SELECT @@sql_mode;

解决方案:
方案1.运行sql,每次重启电脑后都需要重写运行

SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

方案2.如果是Linux,就在配置文件(my.cnf)中修改 sql_mode 的配置(在/usr/local/etc/my.cnf路径下)。如果是Windows,就修改配置文件my.ini文件,添加如下:

sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

重启mysql:

service mysqld restart

mysql解决1055-Expression#22ofSELECT list is not in GROUP BY clause and contains nonaggregated column ‘相关推荐

  1. mysql 报错解决思考Expression #5 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    mysql报错: [Err] 1055 - Expression #5 of SELECT list is not in GROUP BY clause and contains nonaggrega ...

  2. 报错,> 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    错误: mysql: select * ,count(*)as count from app_cash_trans_log group by app_cash_trans_log.tran_code ...

  3. 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'cre

    sql语句 SELECT * FROM t_company_change_log WHERE company_id='257949626441666560' AND rec_status='N' GR ...

  4. MySQL Expression 2 of SELECT list is not in GROUP BY clause and contains nonaggregated column yous

    MySQL:Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'yous ...

  5. 解决SELECT list is not in GROUP BY clause and contains nonaggregated column..

    问题描述 在一次zabbix的mysql库中写联合查询语句时报错 1055 - Expression #1 of SELECT list is not in GROUP BY clause and c ...

  6. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    场景 安装了mysql5.7,用group by 查询时抛出如下异常: Expression #1 of SELECT list is not in GROUP BY clause and conta ...

  7. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'userinfo.

    安装了mysql5.7,用group by 查询时抛出如下异常: Expression #3 of SELECT list is not in GROUP BY clause and contains ...

  8. mysql使用group by查询报错SELECT list is not in GROUP BY clause and contains nonaggregated column.

    mysql使用group by查询报错SELECT list is not in GROUP BY clause and contains nonaggregated column. 出现原因 使用g ...

  9. [MySQL]SELECT list is not in GROUP BY clause and contains nonaggregated column...

    项目在windows上运行正常,迁移到Linux系统上就出现了这个错,经查是由于本人sql不规范且恰好mysql的sql_mode启用了only_full_group_by,当sql语句中使用了分组查 ...

最新文章

  1. 提高语音识别成功率的解决方案思路一
  2. Google Code Jam 2014 总结
  3. 1号店交易系统架构如何向「高并发高可用」演进
  4. C++ MD5类源文件
  5. 谷歌浏览器mac_Mac用户浏览网页不可少的浏览器-谷歌Chrome
  6. 如何将图片中的一个任意四边形区域的图像转化为矩形【附源码】
  7. mongoose Warning:Server Discovery and Monitoring engine is deprecated
  8. html之file标签 --- 图片上传前预览 -- FileReader
  9. linux清理备份日志,服务器日志清理备份
  10. 深入浅出-iOS程序性能优化
  11. [开源][J2ME]J2ME手机应用程序UI开发框架
  12. linux 第三章目录文件管理(上)
  13. c语言 乱序字符,C语言中两种结构体成员初始化方式:顺序和乱序
  14. RH850 MPU 实现介绍
  15. Windows中的工作组
  16. [十大排序]有的人图画着画着就疯了(1.5w字详细分析+动图+源码)
  17. COLLATE LOCALIZED ASC 按本地语言进行排序
  18. Manjaro 安装 MySQL
  19. php pdo oracle 乱码,php pdo 乱码怎么办
  20. 深入理解java虚拟机脑图文档

热门文章

  1. RocketMQ 事务消息
  2. 程序猿生存指南-38 枯木逢春
  3. Java3y文章目录导航
  4. 阿里云中间件团队首次解密企业级分布式应用服务EDAS
  5. 收集的一些android偏方
  6. TCP建立连接三次握手及其断开过程
  7. Java中的三目运算符可能出现的问题
  8. js 手机端触发事事件、javascript手机端/移动端触发事件
  9. 使用threejs点云秀出酷炫的图片效果(一)
  10. Bootstrap-模态框 modal.js