1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

版权声明:本文为博主原创文章,可以转载分享,希望大家相互学习,共同进步 https://blog.csdn.net/shenhonglei1234/article/details/79974466

问题:

1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘cmp-31161029.t1.user_name’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by, Time: 0.000000s

查询sql_mode模式设置:

select @@global.sql_mode

结果:

ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

解决方案:去除 ONLY_FULL_GROUP_BY重新 设置sql_mode

set @@global.sql_mode
=’STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION’

阅读更多

扫码向博主提问

common_util

非学,无以致疑;非问,无以广识
去开通我的Chat快问

没有更多推荐了,返回首页