
1 nosay 2018-09-04 15:38:31 +08:00 不允许 select 不在 group 中的列? 确定吗?我去试了一下,可以执行啊,我是 mysql8.0.3 |
2 cncqw 2018-09-04 15:51:15 +08:00 实际上 MySQL5.7 这样设计才是正确的,5.7 的 sql_mode 有一个 ONLY_FULL_GROUP_BY 配置项,查不在 group 中的列其实没有什么意义,不是 bug,只是 MySQL 更加趋向于严格模式 |
3 cdlixucd 2018-09-04 15:52:38 +08:00 @nosay 我执行了报错‘ ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.Persons.LastName' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by ’ |
4 xy90321 2018-09-04 15:59:55 +08:00 via iPhone 允许非 group by 项目在不带分组函数的情况下被 select 才是奇怪的吧! |
5 zjp 2018-09-04 15:59:56 +08:00 |
7 zjp 2018-09-04 16:03:43 +08:00 楼主能给出表定义吗,我测试还是不行... |
8 Felldeadbird 2018-09-04 16:24:47 +08:00 如果两条数据 group by,会存在 到底取 第一行数据,还是第二行 作为标准呢?二选一的情况,楼主应该有遇到过这个情况。 不过,对于习惯了之前写法的,确实觉得 5.7 的做法反人类…… |