为了账号安全,请及时绑定邮箱和手机立即绑定

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test1.p.type_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test1.p.type_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

正在回答

3 回答

mysql> 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';

————————————————

版权声明:本文为CSDN博主「fansili」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/fansili/article/details/78664267


1 回复 有任何疑惑可以回复我~

修改my.ini配置文件,找到sql_mode去掉only_full_group_by的值。重新启动mysql,就可以了。

0 回复 有任何疑惑可以回复我~
#1

慕田峪4123210

mac怎么找my.ini这个文件啊
2018-07-15 回复 有任何疑惑可以回复我~

select 类别, sum(数量) as 数量之和, 摘要
from A
group by 类别
order by 类别 desc;

需要注意的一点,在select指定的字段要么就要包含在Group By语句的后面,作为分组的依据;要么就要被包含在聚合函数中。


0 回复 有任何疑惑可以回复我~
#1

爱编程的男孩 提问者

66666
2017-11-09 回复 有任何疑惑可以回复我~
#2

qq_姜小帅_0

所以要怎么改一下
2018-01-16 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
与MySQL的零距离接触
  • 参与学习       396886    人
  • 解答问题       3353    个

本课程涵盖全部MySQL数据库的基础,学习MySQL数据库的基础知识

进入课程

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test1.p.type_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信