zoukankan      html  css  js  c++  java
  • 最近升级mysql5.7出现下面问题,ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by

    执行sql:

    SELECT * FROM `user_link` WHERE `group_id` IN ('78', '79') GROUP BY `link_id`   

    报错:

    SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'user_link.group_id' which is not functionally dependent on columns in GROUP BY clause; 
    this is incompatible with sql_mode=only_full_group_by The SQL being executed was: SELECT * FROM `user_link` WHERE `group_id` IN ('78', '79') GROUP BY `link_id`

    执行查看:select @@sql_mode;

    里面默认设置了:sql_mode=only_full_group_by

    only_full_group_by :使用这个就是使用和oracle一样的group 规则, select的列都要在group中,或者本身是聚合列(SUM,AVG,MAX,MIN) 才行,其实这个配置目前个人感觉和distinct差不多的,所以去掉就好

    或者修改sql语句

  • 相关阅读:
    题目1.A乘以B
    题目1.A乘以B
    秋季学习总结
    题目1.A乘以B
    第一周作业
    C语言I博客作业02
    Silverlight中图像的变换(1)
    SQL SERVER 2005安装过程中COM+错误解决!
    c++ 对文件的操作
    JS标准DES加解密
  • 原文地址:https://www.cnblogs.com/zhja/p/9111059.html
Copyright © 2011-2022 走看看