select name, group_id from game group by group_id 报错

阿萨德执行 2020-03-25 04:46:11
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'cloud.game.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
为什么会报错呢

给group_id 加上唯一性索性居然就不报错了
alter table game MODIFY group_id VARCHAR(55) UNIQUE not null;



...全文
249 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
lhdz_bj 2020-03-30
  • 打赏
  • 举报
回复
其实,这个SQL没太大意义,因为分组是为了汇聚,select list中没人做任何汇聚,报错也提到了,这个主要和sql_mode参数有关。

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧