1、问题:

查询语句:

select count(support) supportCount,count(collection) collectionCount, support,collection 
from like_collect  where articleId = 2;(注意:此处未使用group by语句声明非聚集函数列)

报错描述:In aggregated query without GROUP BY, expression #3 of SELECT list contains nonaggregated column 'pet.like_collect.support'; this is incompatible with sql_mode=only_full_group_by

2、分析报错原因:

mysql的sql_mode默认开启了only_full_group_by 模式

3、解决方法:

把SQL语句中非聚集函数列再group by后声明即可

select count(support) supportCount,count(collection) collectionCount, support,collection 
from like_collect  where articleId = 2  GROUP BY support,collection;

In aggregated query without GROUP BY相关推荐

  1. In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column...

    ERROR 1140 (42000): In aggregated query without GROUP BY, expression #1 of SELECT list contains nona ...

  2. In aggregated query without GROUP BY报错

    记录一下关于mysql的一个报错问题解决方案:In aggregated query without GROUP BY, expression #1 of SELECT list contains n ...

  3. mysql查询出现In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated c

    1.问题: Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: In ...

  4. In aggregated query without GROUP BY是什么错误

    本文所使用的表: 表 sc ±-----±------+ | sid | score | ±-----±------+ | 01 | 80.0 | | 01 | 90.0 | | 01 | 99.0 ...

  5. mysql:In aggregated query without GROUP BY, expression #1 of SELECT list contains...........

    文章目录 问题描述 问题溯源 解决方式一 解决方法二 附录: 问题描述 下面是报错截图: 1140 - In aggregated query without GROUP BY, expression ...

  6. MYSQL||报错:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated

    碎碎念: 兄弟萌,我胡汉三又回来啦(。・∀・)ノ゙嗨,最近在期末考,一不小心二十几天没发博了,年底KPI没冲成功,今天就来补一下下§(* ̄▽ ̄*)§ 一.问题描述 今天在牛客网做SQL的题:牛客的课程 ...

  7. mysql 报错:1140 In aggregated query without GROUP BY, expression #

    1140 In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated colum ...

  8. MySQLSyntaxErrorException: In aggregated query without GROUP BY聚合查询语法异常

    MySQLSyntaxErrorException: In aggregated query without GROUP BY,this is incompatible with sql_mode=o ...

  9. mysql报错In aggregated query without GROUP BY

    执行语句: select de.dept_no, count(s.salary) from salaries s left join dept_emp de on s.emp_no = de.emp_ ...

最新文章

  1. 八年级计算机网络公开课,计算机网络公开课教案.doc
  2. 如何在Python中对字符串进行子字符串化
  3. init/main.c中的void init(void)
  4. java象棋无框架版_Java版中国象棋
  5. 微软云创益大赛获奖团队风采:做一个中国特色的.Net源代码社区
  6. ubuntu14中 memcached安装与使用
  7. python中获取python版本号的方法
  8. 【Java心得总结六】Java容器中——Collection
  9. 嵌套查询和连接查询的效率_Elasticsearch 7.x Nested 嵌套类型查询 | ES 干货
  10. RabbitMQ笔记-使用rabbitmq-c实现Fair dispatch(公平分发)
  11. 分布式监控系统ganglia配置文档
  12. 阿里云 centos mysql 5.6_关于centOS安装配置mysql5.6那点事
  13. ubuntu终端执行shell脚本报command not found解决方法
  14. POJ3618 Exploration【水题+排序】
  15. 如何使用Tuxera NTFS for Mac禁用特定NTFS分区
  16. win10图片打不开无法注册包
  17. Java项目:基于jsp+mysql+Spring+SpringMVC+mybatis的高速公路收费管理系统
  18. Excel 固定显示表头 / 列头
  19. 中台之上(三):战略和组织结构,业务架构设计中不应被忽视的关键因素
  20. Python停车管理系统毕业设计-附源码271400

热门文章

  1. 美国养育孩子十七绝招
  2. 在UWP应用中加入Cortana语音指令集
  3. linux 挂载 SD 卡
  4. LeetCode 36. Valid Sudoku(九宫格数独)
  5. 阿里妈妈广告预测线上0.082+baseline,特征部分
  6. 【大学物理·光学】单缝的夫琅禾费衍射
  7. 基于ATMEGA8A_AVR单片机温度测控系统proteus仿真
  8. Matlab画的eps图片中的Helvetica字体不能嵌入问题的解决办法
  9. 是男人就坚持20秒—python版本
  10. suse linux关机命令,suse linux 常用命令