mysql解决1055-Expression#22ofSELECT list is not in GROUP BY clause and contains nonaggregated column ‘
问题:
在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 ‘相关推荐
- 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 ...
- 报错,> 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 ...
- 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 ...
- 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 ...
- 解决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 ...
- 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 ...
- 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 ...
- [MySQL]SELECT list is not in GROUP BY clause and contains nonaggregated column...
项目在windows上运行正常,迁移到Linux系统上就出现了这个错,经查是由于本人sql不规范且恰好mysql的sql_mode启用了only_full_group_by,当sql语句中使用了分组查 ...
最新文章
- 提高语音识别成功率的解决方案思路一
- Google Code Jam 2014 总结
- 1号店交易系统架构如何向「高并发高可用」演进
- C++ MD5类源文件
- 谷歌浏览器mac_Mac用户浏览网页不可少的浏览器-谷歌Chrome
- 如何将图片中的一个任意四边形区域的图像转化为矩形【附源码】
- mongoose Warning:Server Discovery and Monitoring engine is deprecated
- html之file标签 --- 图片上传前预览 -- FileReader
- linux清理备份日志,服务器日志清理备份
- 深入浅出-iOS程序性能优化
- [开源][J2ME]J2ME手机应用程序UI开发框架
- linux 第三章目录文件管理(上)
- c语言 乱序字符,C语言中两种结构体成员初始化方式:顺序和乱序
- RH850 MPU 实现介绍
- Windows中的工作组
- [十大排序]有的人图画着画着就疯了(1.5w字详细分析+动图+源码)
- COLLATE LOCALIZED ASC 按本地语言进行排序
- Manjaro 安装 MySQL
- php pdo oracle 乱码,php pdo 乱码怎么办
- 深入理解java虚拟机脑图文档