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

GROUP BY错误

mysql> SELECT sex,age FROM users GROUP BY 1 HAVING age>35;

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

mysql> SELECT sex,age FROM users GROUP BY 1 HAVING age>35;

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

这是为什么

正在回答

1 回答

mysql> select age from userinfo group by gender;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and c
ontains nonaggregated column 'apollo.userinfo.age' which is not functionally dep
endent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

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

举报

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

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

进入课程

GROUP BY错误

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