在MySQL语法Group By时报错
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'db1.product.id'
which is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by, Time: 0.000000s
我的MySQL版本为:mysql-8.0.27
解决方案:
先执行
select @@global.sql_mode
结果为:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
再执行下面语句
set @@global.sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
然后,重启Navicat!!!,才会生效。
更多推荐