网站首页 数据库 which is not functionally dependent on columns in GROUP BY clause; this is incom
which is not functionally dependent on columns in GROUP BY clause; this is incom
编辑时间:2019-11-02 14:16:44 作者:admin 浏览量:3635

错误提示:

1055 - Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'wzry.products.p_view' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by, Time: 0.000000s

错误的原因是我mysql版本是5.7的,使用如下语句查询可知

select @@sql_mode;

里面默认设置了

sql_mode=only_full_group_by

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

修改配置文件


打开mysql配置文件:my.cnf

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

 



    上一篇:Homestead 安装 PHP Redis 扩展
    下一篇:使用vscode打开wepy项目
    出自:洪庆柳

    地址:www.xmaniu.com

    转载请注明出处!