mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by

错误的原因是我mysql版本是5.7的,使用如下语句查询可知
select @@sql_mode;
里面默认设置了
sql_mode=only_full_group_by

解决办法:
[mysqld]下 配置文件 添加

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

重启mysql 服务即可

你可能感兴趣的:(mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by)