本文主要是介绍报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在Navicat中执行SQL语句时,报以下错:
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
解决方法一:
在MySQL中执行:
select version(),
@@sql_mode;SET sql_mode=(SELECT REPLACE(@@sql_mode,‘ONLY_FULL_GROUP_BY’,’’));
这个方法只能解决当前的,最佳答案还是用解决方法二。
解决方法二:
修改MySQL的配置文件 my.ini
,在[mysqld]
下面增加代码:
sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION’
如图:
修改完my.ini文件后需要重启一下MySQL服务,如果是windows系统,则执行:
net stop mysql
net start mysql
这篇关于报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!