报错信息:

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. go ice相关配置

    set GO111MODULE=on set GOPROXY=https://goproxy.cn,direct set GOPRIVATE=*.jd.com go get git.jd.com/ch ...

  2. shell语句记录

    sed篇: 1. 删除指定的字符,比如 'a'-----$ sed 's/a//' file 2. 移除每一行的第一个字符----$ sed 's/^.//' file 3. 移除每一行的最后一个字符 ...

  3. 如何把高德地图搜索商家电话资料导出成excel里?

    有很多人问我地图商家结果采集怎么做? 怎么样能够快速的把高德地图左边的搜索列表里的商家地图,电话,导出到EXCEL里. 如何快速地将高德地图里的商家电话资料导出EXCEL? 操作步骤: 1. 选择你要 ...

  4. 裁员潮下,我月薪3W依旧坚挺

    近几年来产品经理一直是求职市场中的香饽饽: 年薪20w起.没有专业限制.职业天花板高,甚至行业中一直流传着一句话:产品经理是CEO的学前班. 在各种光环的加持下,不少应届生或有转行打算的职场人都将目光 ...

  5. 样本方差S²中为什么是乘以1/(n-1)或者说除以n-1?贝塞尔校正,无偏估计

    样本方差S²中为什么是乘以1/(n-1)或者说除以n-1?贝塞尔校正,无偏估计 前言:重在记录,可能出错. 先看样本方差的公式如下: S2=1n-1∑i=1n(Xi-X¯)2=1n-1(∑i=1nXi ...

  6. python连接Oracel、postgreSQL、SQLserver、Mysql、mongodb、redis等常用数据库方法汇总

    python对接常用数据库 python有着极其丰富的第三方的库,如此强大的python语言操作各大数据库,不管你使用的关系型数据库是oracle,mysql, sqlserver,还是关系型数据库r ...

  7. LOD Group

    LOD Group 调节摄像机距离,在不同的距离显示不同物体.常用于物体高低模之间的转换,如离摄像机较远时渲染低模物体,离摄像机较近时渲染高模物体.

  8. spider_ip代理

    title: spider_ip代理 author: 杨晓东 permalink: spider_ip代理 date: 2021-10-02 11:27:04 categories: - 投篮 tag ...

  9. Mac预览怎么用 Mac预览功能实用技巧大全

    Mac预览怎么用?有很多的用户以为Mac自带的预览功能只具有简单的图片浏览功能,其实不然,其实"预览"是一款强大的看图.修图.改图软件,也同时是一款多功能的 PDF 阅读与编辑工具 ...

  10. js - script标签的for属性和event属性

    js - script标签的for属性和event属性 <script language="javascript" for="window" event= ...