Mysql in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 报错解决方案(thinkPHP5.0--5.1)
Posted on 2022-07-01 13:48 君子不卿 阅读(651) 评论(0) 编辑 收藏 举报报错信息:
1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'xinhui_sysmgr.s.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
在SQL 或 Navicat 中执行 :
set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,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';
set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
备注:需要选择到对应数据库,在执行该sql语句。不然就会出现在这个这个库可以执行,但是其他库不能执行group by 语句。