报错信息:

Expression #1 of SELECT list is not in GROUP BY clause and contains 
nonaggregated column ‘a.rsc_adj_no’ which is not functionally 
dependent on columns in GROUP BY clause; this is incompatible with 
sql_mode=only_full_group_by

选择列表中的一个不在GROUP BY子句中,它包含非聚合列“ rsc_adj_no ”,在功能上不存在依赖于GROUP BY子句中的列。这与sql_mode = only_full_group_by相悖

解决方法:

1. select @@global.sql_mode; 查询结果若包括ONLY_FULL_GROUP_BY,使用 set @@global.sql_mode="xxxx";  (去掉ONLY_FULL_GROUP_BY的其他字符串)重新设置即可

2. 修改my.cnf 文件后,重启mysql

[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

3. 使用函数any_value把报错的字段name包含起来。如,

  select any_value(rsc_adj_no) rsc_adj_no,any_value(bill_no) bill_no from table group by bill_no;

Expression #1 of SELECT list is not in GROUP BY clause and contains nonag的更多相关文章

  1. [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 ...

  2. 【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 ...

  3. 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 ...

  4. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre

    原文链接:https://blog.csdn.net/hq091117/article/details/79065199 https://blog.csdn.net/allen_tsang/artic ...

  5. 记录一次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 ...

  6. mySql中Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题

    报错信息 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a.id' ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

  10. 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 ...

随机推荐

  1. vue 图片转base 64

    // 将图片转换为Base64imageUrlToBase64(img) { // 一定要设置为let,不然图片不显示 let image = new Image(); // 解决跨域问题 image ...

  2. .netcore webapi的返回值和过滤器

    1.返回值. 1.1直接返回数据 1.2 数据+状态码 返回这种类型IActionResult 可以使用return OK(T).return NotFound(T) 1.3前两种的混合使用Actio ...

  3. css 多行隐藏

    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box- ...

  4. AIIE21th003: 2021年第二届国际工业工程和人工智能大会(IEAI 2021)

    会议亮点: 1.IEAI2021由ACM新加坡分会赞助举办,它是MSIE 2021的分会. 2.被接收的文章会被发表在ACM国际论文集上,并被EI Compendex, Scopus, Thomson ...

  5. 织梦dedecms网站迁移搬家图文教程

    织梦dedecms网站迁移搬家图文教程 2014-07-31  dedecms教程  文章介绍 织梦作为国内使用最多的程序之一,难免很多新手在接触dede时不知道怎么转移也就是搬家dede的程序,而且 ...

  6. Mac 下的虚拟机Parallels_Desktop_15

    Mac 下的虚拟机Parallels_Desktop_15 1,取得 Mac Parallels_Desktop_15.dmg 后挂载,密码:7410   2,点关闭!关闭!关闭!,千万不要点&quo ...

  7. hdfs操作——hdfs的shell命令和hdfs的JavaAPI操作

    hdfs解决hadoop海量数据的存储. shell 命令(所有hadoop fs 可由 hdfs dfs代替) (1) 在hdfs上创建目录 hadoop fs -mkdir 目录名 (2) 本地文 ...

  8. Linux基础第十章:系统安全及应用

    目录 一.账户安全措施 1.账户管理 2.锁定配置文件 3.清除历史记录 二.sudo 1.sudo概念及优点 2.使用sudo 3.sudo实操演示 4.设置sudo别名 5.sudo特别注意 一. ...

  9. Java执行cmd命令工具类

    工具类: public class CmdTask implements Runnable { private String command; private String dirPath; publ ...

  10. IDEA的主题插件

    Xcode-Dark Theme