SQL---Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column '
2017-12-27 17:45
1066 查看
数据库中插入数据或执行sql语句时一直报下面这个错误:
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
原因:这是数据库的sql_mode设置的有问题。Mysql可以支持不同的SQL模式,不同的SQL模式会有不同的语法,执行不同的数据校验简查。
首先,可以先查看一下数据库现在的sql_mode的值,sql语句为:
select version(), @@sql_mode;
获取结果可能如下,不同的设置查询出来的有区别:
![](https://img-blog.csdn.net/20171227175135875?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd2VpeGluXzM5ODAwMTQ0/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
然后可以使用如下语句,去设置自己需要的sql_mode.
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
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
原因:这是数据库的sql_mode设置的有问题。Mysql可以支持不同的SQL模式,不同的SQL模式会有不同的语法,执行不同的数据校验简查。
首先,可以先查看一下数据库现在的sql_mode的值,sql语句为:
select version(), @@sql_mode;
获取结果可能如下,不同的设置查询出来的有区别:
然后可以使用如下语句,去设置自己需要的sql_mode.
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
相关文章推荐
- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'inform
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- mysql错误:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'ga
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated..
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated..
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated.
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'userinfo.
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- SELECT list is not in GROUP BY clause and contains nonaggregated column this is incompatible with sql_mode=only_full_group_by
- MySQL: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column '
- mysql 5.7 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonag
- #1055 - Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this i
- mysql:Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column
- MySQL: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sss
- [Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated colum