今天在做按时间分组统计数据时,一段sql在数据库运行正常,但是在java代码中抛出了异常:
sql语句:

SELECT DATE_FORMAT( commitTime, '%H' ) AS gjtime , COUNT(1) AS gjsum FROM jenkins_data GROUP BY gjtime ORDER BY commitTime DESC

java 抛出的异常信息:

Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column

不明所以,网上也给出了很多的处理方法,修改my.cnf,这类的居多,但也从中看到一篇文章,他直接把ORDER BY commitTime DESC语句更改为ORDER BY MAX(commitTime) DESC
修改后的语句:

SELECT DATE_FORMAT( commitTime, '%H' ) AS gjtime , COUNT(1) AS gjsum FROM jenkins_data GROUP BY gjtime ORDER BY MAX(commitTime) DESC

这样在执行就没有问题了。

mysql 5.7版本异常Expression #1 of ORDER BY clause is not in GROUP BY clause and contains 处理相关推荐

  1. MySQL报错1055解决办法:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains

    [mysql报错1055 报错解决办法][Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and cont ...

  2. mysql Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nona

    1. 操作mysql的时候提示如下错误 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and cont ...

  3. [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated

    mysql客户端查询报这个错误,如下所示: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and co ...

  4. [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c

    [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c ...

  5. 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contai

    文章目录 1. 现象 2. docker内部mysql容器 解决方案 3. windows和linux 解决方案 1. 现象 在使用sql语句创建表时,报错: 1055 - Expression #1 ...

  6. [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated解决

    今天在使用MySQL查询时报了一个"[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and c ...

  7. [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause 的问题 MySQL

    show variables like "sql_mode"; set sql_mode=''; set sql_mode='NO_ENGINE_SUBSTITUTION,STRI ...

  8. sql [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause

    解决当时 错误 show variables like "sql_mode";set sql_mode='';set sql_mode='NO_ENGINE_SUBSTITUTIO ...

  9. mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 我的情况 : Mysql 5.7.21 版本运行sql 报错如题,同样的 sql 直接本地运行不报错 ...

最新文章

  1. 无线传感器网络协议与体系结构 思维导图 (book) Protocols and Architectures for Wireless Sensor Networks, Holger Karl
  2. 使用java搭建直播平台,我就不信你还听不明白了!
  3. settimeout需要清除吗_钢结构抛丸机可以清理结构件上的焊渣吗?
  4. 最新 MSDN Library for Visual Studio 2008 SP1
  5. 揭秘:美国警方监控技术大曝光
  6. poco c++ 开发指南_掌握这个框架,你将会开发通杀全平台的万能爬虫
  7. hihocoder1089 Floyd算法
  8. deepin tim(wine)无法安装_浅析国产操作系统深度deepin
  9. RANSAC算法拟合平面实现
  10. CAD中插入外部参照字体会变繁体_CAD发给客户没字体怎么办?快速打包外部参照、字体、打印样式...
  11. MySQL基础查询语句练习题
  12. 邮件作为证据如何提交_【欣法官在线】收到起诉状副本,我该如何向法院提交证据?...
  13. ccsa安学网小程序_CCSA安学网安全题库
  14. 浙江省2级C语言等级考试答案,2021年秋浙江省计算机等级考试二级C试卷及答案...
  15. 一文读懂图像数据的标准化与归一化
  16. 百度一键Root使用教程
  17. ORALC常用函数(五)----STDDEV、STDDEV_POP、STDDEV_SAMP等函数
  18. 欧洲证券监管机构将于2019年前报告ICO监管规则
  19. 比较好的android 手机号码,安卓手机最好的系统(五大公认最好用的安卓手机系统)...
  20. 遇到代码不生效或者报错不要慌

热门文章

  1. 论文阅读:《Neural Machine Translation by Jointly Learning to Align and Translate》
  2. jvm 内存查看与分析工具
  3. POJ 2152 树型DP //很棒的题
  4. POJ1659 Frogs' Neighborhood(Havel定理)
  5. UVA 1665 Islands
  6. android和chrome的发展与未来[j].移动通信,基于Android手机app开发与设计 毕业设计 开题报告...
  7. PJzhang:贷款逾期与失信被执行人
  8. PyTorch强化:01.PyTorch 数据加载和处理
  9. uniapp微信小程序打电话
  10. 维恩贝特面试java后端开发面试经验