报错信息:

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 点击元素滚动到指定位置(滑动到指定位置对应标签自动选中)

    一:各个模块不相同情况 1.内容部分<div class="anchor"> <div v-for="(item,index) in anchors&q ...

  2. [原创] CSS自定义IOS苹果,Android安卓的CheckBox 效果,可以根据文字大小变化而变化,内框显示文字,另外可自定大小,自定颜色

    在经过对网上一些自定CheckBox的一番研究之后,现在综合讲一下该样式实现的技巧. 先上图: 图中已展示了多种样式,实现的原理很简单,一个外Box,一个内Box,外Box显示背景色,内Box显示白色 ...

  3. 没解决的问题-git连接失败

    [parallels@localhost ~]$ ssh-keygen -t rsa -C '1012144290@qq.com'Generating public/private rsa key p ...

  4. Vulnhub 靶场 HMS?: 1

    Vulnhub 靶场 HMS?: 1 前期准备: 靶机地址:https://www.vulnhub.com/entry/hms-1,728/ 攻击机ip:192.168.147.190 靶机ip:19 ...

  5. ubuntu启动盘制作

    转自https://www.cnblogs.com/silentdoer/p/13044305.html 1. 从Ubuntu官网http://cn.ubuntu.com/download/下载系统的 ...

  6. git 初始化新的文件夹

    1.  tar xvf new_project.tar.gz 2. cd  new_project 3. git config --global user.email "user.name@ ...

  7. 面试视频知识点整理1-13(mvvm框架)

    1.了解mvvm框架吗? Vue.js React Angular 2.谈谈你对mvvm的认识 由mvc和mvp演变而来 3.双向绑定是什么原理? object.defineProperty的用法要熟 ...

  8. 5分钟上手使用vuex,vuex状态管理,vuex遇到的坑

    很多刚学习vue的人对于全局变量管理工具vuex都觉得很神秘,今天就用很通俗的大白话协助大家理解一下vuex,作者的vue项目使用vue脚手架搭建的,用脚手架搭建的项目会在src文件夹下有一个stor ...

  9. nodejs+koa 后台框架结构、demo学习地址

    框架结构例子 https://github.com/bayi-lzp/koa-template 官网例子(有很多 示例) https://github.com/koajs/examples <K ...

  10. kora 简单使用实现Api接口 以及mongodb简单使用

    //api.jsconst Koa = require('koa'); const router = require('koa-router')(); //路由 const bodyParser = ...