SELECT name,phone FROM sys_user
GROUP BY name HAVING COUNT(1) >= 2
> 1055 - Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'gas_web_gb.B.parent_module_code' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
> 时间: 0.008s
是由于默认的 MySQL 配置中 sql_mode 配置了 only_full_group_by,需要 GROUP BY 中包含所有 在 SELECT 中出现的字段。
4. only_full_group_by:使用这个就是使用和oracle一样的group 规则, select的列都要在group中,或者本身是聚合列(SUM,AVG,MAX,MIN) 才行。
SELECT @@sql_mode;
如果是Linux,就在配置文件(my.cnf)中修改 sql_mode 的配置(在/etc/my.cnf路径下)。如果是Windows,就修改配置文件my.ini,我的是Windows,如下所示:
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有