【mysql】this is incompatible with sql_mode=only_full_group_by错误修复

错误代码

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

修改步骤

  1. 登录Navicat,然后在新建的查询中输入如下的语句
SELECT @@GLOBAL.sql_mode;
  1. 查看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
  1. 更新sql_mode内容
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 ';

在这里插入图片描述
4. 查看结果是否修复成功
在这里插入图片描述

你可能感兴趣的:(SQL)