mysql命令gruop by报错only_full_group

2018-11-20  本文已影响0人  缓慢移动的蜗牛

问题

在mysql 工具 ORDER B搜索时报下面错误:

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database_tl.emp.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

查看mysql的版本

SELECT VERSION();
# 5.7.21

查看sql_model参数命令

SELECT @@SESSION.sql_mode;
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

第一项默认开启ONLY_FULL_GROUP_BY

解决方法

上一篇 下一篇

猜你喜欢

热点阅读