首页 > 代码库 > mysql连表分组报错---- sql_mode=only_full_group_by问题解决
mysql连表分组报错---- sql_mode=only_full_group_by问题解决
####
sql语句报错问题
#1055 - Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘cash.sdb_login_log.id‘ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
###
官方文档的解决方法:
文档链接:
https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-setting
查询mysql服务器版本:
select @@version
显示:
5.7.10
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
#查看sql_mode的语法
select @@GLOBAL.sql_mode;
select @@SESSION.sql_mode;
#修改sql_mode的语法
SET GLOBAL sql_mode = ‘modes‘;
SET SESSION sql_mode = ‘modes‘;
或者 set sql_model=‘’;
mysql连表分组报错---- sql_mode=only_full_group_by问题解决