SELECT list is not in GROUP BY clause and contains nonaggregated column this is incompatible with sql_mode=only_full_group_by
2017-07-17 11:02
1286 查看
使用 select @@sql_mode; 命令可以看到,数据库设置了 ONLY_FULL_GROUP_BY 的mode,意思就是:
对于GROUP BY聚合操作,如果在SELECT中的列,没有在GROUP BY中出现,那么这个SQL是不合法的,因为列不在GROUP BY从句中
所以对于设置了这个mode的数据库,在使用group by 的时候,就要用MAX(),SUM(),ANT_VALUE()这种聚合函数,才能完成GROUP BY 的聚合 操作。
执行
对于GROUP BY聚合操作,如果在SELECT中的列,没有在GROUP BY中出现,那么这个SQL是不合法的,因为列不在GROUP BY从句中
所以对于设置了这个mode的数据库,在使用group by 的时候,就要用MAX(),SUM(),ANT_VALUE()这种聚合函数,才能完成GROUP BY 的聚合 操作。
执行
相关文章推荐
- #1055 - Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this i
- #1055 - Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this i
- #1055 - Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this i
- MySQL分组查询时出现错误SELECT list is not in GROUP BY ;this is incompatible with sql_mode=only_full_group_by
- mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
- Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'userinfo.
- MySQL: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sss
- MySQL: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column '
- mysql错误:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'ga
- 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 'lo
- Mysql解决SELECT list is not in GROUP BY clause and contains nonaggregated column 问题
- mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
- [Err] 1055 - Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated colum
- [Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated colum
- mysql5.7建表时报错clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
- [Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated colum
- Error Code: 1055. Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated
- SQL---Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column '
- mysql遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题