[Err] 1055 – Expression #10 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘xxx’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
MySQL 5.7.x 默认是开启了 ONLY_FULL_GROUP_BY
我知道这样不规则,有隐患。
但问题是开发服上是没开的,之前项目的代码都是这么写的,不把本地处理一下,我几乎没法干活。不可能去把别人写的SQL
全改了吧。
— 默认 SET @@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”; — 去掉 ONLY_FULL_GROUP_BY 其它不变 SET @@GLOBAL.sql_mode=“STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”;
改完了要在新打开的查寻窗口才有用,原来的没有效果的。
pwot9j