解决SELECT list is not in GROUP BY clause and contains nonaggregated column ‘XXX’
解决SELECT list is not in GROUP BY clause and contains nonaggregated column ‘XXX’
我是在Linux上面新装了一个mysql5.7的数据库,然后上传项目,日志中出现了这个错误信息。
网上找了许久,终于解决了,将解决方法记录如下。
1、查询 sql_mode
select @@sql_mode;
1
查询出来是 ONLY_FULL_GROUP_BY
这个严格限制了分组的条件。 解释请看这篇文章
2、去掉ONLY_FULL_GROUP_BY,重新设置值。
set @@sql_mode =‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION‘;
1
2
上面 改变了全局sql_mode,对于新的数据库有效。已存在的数据库,则无效。
3、最终解决办法
Linux上面是在my.cnf设置 一般是在 vi /etc/my.cnf 路径
Windows 上面是my.ini设置。
[mysqld]
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
解决SELECT list is not in GROUP BY clause and contains nonaggregated column ‘XXX’相关推荐
- 解决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 ...
- 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 ...
- 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 ...
- 报错,> 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 ...
- 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 ...
- 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 ...
- SELECT list is not in GROUP BY clause and contains nonaggregated column
问题: SELECT list is not in GROUP BY clause and contains nonaggregated column 原因: 举个例子,有这么一个查询语句: SELE ...
- 使用group by语句时,报错,获取不到数据,出现SELECT list is not in GROUP BY clause and contains nonaggregated column 问题
SELECT list is not in GROUP BY clause and contains nonaggregated column 报错如下: Expression #2 of SELEC ...
- [MySQL]SELECT list is not in GROUP BY clause and contains nonaggregated column...
项目在windows上运行正常,迁移到Linux系统上就出现了这个错,经查是由于本人sql不规范且恰好mysql的sql_mode启用了only_full_group_by,当sql语句中使用了分组查 ...
最新文章
- 饭后半小时养胃黄金期
- Android MVVM 架构应用实现
- 年月日_C++计算输入的年月日是这一年的第几天
- spark rest_Spark简介,您的下一个REST Java框架
- html响应式五栏布局,HTML – 响应式2列CSS布局,包括固定宽度的侧边栏?
- Symfony 4.2.4 和 3.4.23 发布,经典 PHP Web 开发框架
- c专家编程(C专家编程pdf)
- Premiere Pro 2022安装教程(附详细图文教程)
- LPC1788学习笔记(19-01-11)
- 公司合同管理软件有哪些?
- FDTD PDMS光学参数txt文档
- idea社区版激活_使用IntelliJ IDEA社区版代替付费版
- molar mass
- 清除电脑bios密码
- 【我的渲染技术进阶之旅】关于C++轻量级界面开发框架Dear ImGui介绍
- C语言克鲁斯卡尔算法的实现
- java基础之静态方法
- 从IE到Chromium Edge:微软浏览器的浮沉史
- 大数据说:原来“首堵”不是北京!
- DeviceIoControl接口