Mysql Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘xx‘
MySql执行分组sql报错:
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated
column 'db.tir1.display_name' which is not functionally dependent on columns in
GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
原因:使用GROUP BY 语句违背了sql_mode=only_full_group_by,该SQL是不合法的。使用group by分组查询的时候,在select列中查询的字段在group by中不存在,并且改字段没有在聚合函数里面。会报sql不合法。 mysql 5.7默认启用ONLY_FULL_GROUP_BY特性。
解决方法
- 在mysql的配置文件的最后强制设置sql_mode,把默认的ONLY_FULL_GROUP_BY去掉。
重新启动mysql后生效。 - 全局配置修改
查询:
select @@global.sql_mode
设置:
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'
退出生效。对于新建的立即生效。
最后还是建议大家合法编写SQL语句进行。除非是业务需要,不然不到万不得已千万不要擅自修改配置信息。
Mysql Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘xx‘的更多相关文章
- [mysql] Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'loser.tank_admin.login_ip' which is not functionally dependent on columns in GROUP BY clause; this is
执行SQL: SELECT login_name,login_ip,sex FROM tank_admin GROUP BY login_name ; 时抛出异常. Expression #2 of ...
- 【mybatis】【mysql】mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column
mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains no ...
- Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'blog.t_blog.addTime' which is not functi
sql报错: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT ...
- 记录一次mysql由5.6升级到5.7出现的异常---Expression #23 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'c.commentCount' which is not functionally dependent on columns in GROUP BY clause;
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expre ...
- MYSQL报错:1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'rpa ...
- mysql升级后出现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 ...
- Error Code: 1055.Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'userinfo.
环境:mysql-8.0.15-winx64 问题描述: Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expre ...
- Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column
Error: javax.servlet.ServletException: java.sql.SQLSyntaxErrorException: Expression #4 of SELECT lis ...
- Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'userinfo.
安装了mysql5.7,用group by 查询时抛出如下异常: Expression # of SELECT list is not in GROUP BY clause and contains ...
- Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column
安装了mysql5.7.19后,执行语句中只要含有group by 就会报这个错 [Err] 1055 - Expression #1 of ORDER BY clause is not in GRO ...
随机推荐
- (十五).web字体
WEB字体 1.1 web 字体基本语法 /* 引入Web字体 给web字体取名字*/ @font-face { font-family: "FZSJ-WSMQSJW"; src: ...
- MFC的对话框使用Scintilla
工作中需要做一个脚本编辑器的工具,用于代码补全.语法高亮.错误提示等功能,可以直接使用开源控件Scintilla, 网上有一些MFC的多文档使用Scintilla的例子,项目中使用的是对话框,自己实现 ...
- 新的世界,我们推荐不劳而获 -> 持续更新中
随着技术带来的生产力爆发越来越猛烈,有人提出是不是有必要保留一些落后的生产工艺及相关岗位,以避免社会动荡. 我的答案:不用.但是要改变社会对于不劳而获的态度:我们对于生活资料的不劳而获持接受的态度,但 ...
- jieba初
url: https://github.com/fxsjy/jieba/blob/master/ jieba "结巴"中文分词:做最好的 Python 中文分词组件 "J ...
- ggplot axis text 拐弯
scale_y_discrete(position = "left",labels=function(x) str_wrap(x, width=48)) +
- navicat for mysql (本人亲测,真实有效)
参考: https://www.cnblogs.com/myprogramer/p/10534481.html 第一步:下载软件 先从Xclient上下载下来Navicat Premium 12.0. ...
- XML元素限定
XML元素限定的意义:XML 用于数据交换,而标签又是可以任意定义的,为了让 XML 的编写者和使用者之间能正确交流----->需要对标签等约定.在 XML 中有两种约定方法 dtd 格式和 x ...
- GDB使用详解
来源:GDB使用详解 - 知乎 (zhihu.com) 1. 概述 GDB 全称"GNU symbolic debugger",从名称上不难看出,它诞生于 GNU 计划(同时诞 ...
- Android 音视频 - EGL 源码解析以及 C++ 实现
OpenGL 是一个跨平台的 API,而不同的操作系统(Windows,Android,IOS)各有自己的屏幕渲染实现.所以 OpenGL 定义了一个中间接口层 EGL(Embedded Graphi ...
- webgl 系列 —— 绘制猫
其他章节请看: webgl 系列 绘制猫 上文我们了解了如何绘制渐变彩色三角形,明白了图形装配.光栅化,以及片元着色器计算片元的颜色. 现在如果让你绘制如下一只猫.难道绘制很多三角形,然后指定它们的颜 ...