在mysql的学习中,不是很清楚什么是 FULL_GROUP_BY。
想着不改变全局变量的 @@sql_mode 来达到类似于分组、统计的效果。
在CSDN上浏览的博客都是教怎么改变MySQL。
既然MySQL这样做了,肯定有它的道理,该变的是我们。是我们该学习完全分组(FULL_GROUP)是怎么表述的儿不是去更改MySQL。
所以请教一下: MySQL8怎么写才能在不修改原本配置的条件下做到 分组计数、最大值、最小值等操作?
MySQL Server Version: 8.0.26
select *,count(*) as cou from stu group by age;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated
column 'firstDB.stu.StuNum' which is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by