zoukankan      html  css  js  c++  java
  • mysql5.7执行sql语句报错:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonagg

    mysql5.7执行sql语句报错:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'yunva_changke.u.user_id'; this is incompatible with sql_mode=only_full_group_by


    1.方法1,需要重启mysql服务


    编辑/etc/my.cnf文件,加入如下参数,重启mysql
    sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"


    2.方法2,不需要重启mysql服务


    可以看到模式为only_full_group_by
    mysql>show variables like '%sql_mode';

    mysql> show session variables like '%sql_mode%';
    mysql> show global variables like '%sql_mode%';


    使当前会话失效
    mysql> set global sql_mode='';
    mysql> set session sql_mode='';

  • 相关阅读:
    tensorflow 学习
    join-semi and join-anti
    深入拆解Tomcat_Jetty 笔记
    Set化
    DDD实战-笔记
    高并发系统设计-笔记
    技术管理
    性能调优-笔记
    程序员是如何思考的-笔记
    LeetCode
  • 原文地址:https://www.cnblogs.com/reblue520/p/6239710.html
Copyright © 2011-2022 走看看