Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'java221.score.num' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 是哪里出错
时间: 2023-10-13 09:05:10 浏览: 30
这是一个 SQL 查询语句的错误提示,大致意思是:SQL 查询语句中的第二个表达式在 GROUP BY 子句中不存在,并且包含一个非聚合列 'java221.score.num',该列在 GROUP BY 子句中不是函数依赖关系,这与 sql_mode=only_full_group_by 不兼容。
这通常是由于使用了新版本的 MySQL 数据库而导致的。在新版本中,MySQL 默认启用了 ONLY_FULL_GROUP_BY 模式,该模式要求 SELECT 语句中的所有非聚合列都必须在 GROUP BY 子句中出现。
要解决这个问题,可以将查询语句中的所有非聚合列都添加到 GROUP BY 子句中,或者将 ONLY_FULL_GROUP_BY 模式禁用。具体方法可以查阅 MySQL 数据库的文档。
相关问题
SELECT list is not in GROUP BY clause and contains nonaggregated column 'a.V_TENOR1' which is not functionally
SELECT list is not in GROUP BY clause and contains nonaggregated column 'a.V_TENOR1' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by.
这个错误通常在使用GROUP BY子句时出现。它表示SELECT列表中的某些列没有在GROUP BY子句中,并且这些列不是函数依赖于GROUP BY子句中的列。这与sql_mode=only_full_group_by不兼容。
解决这个问题的方法有两种:
1. 将非聚合列添加到GROUP BY子句中:将SELECT列表中的非聚合列添加到GROUP BY子句中,以确保所有列都被正确分组。
2. 使用聚合函数处理非聚合列:如果你不需要将非聚合列添加到GROUP BY子句中,可以使用聚合函数(如SUM、MAX、MIN等)对这些列进行处理,以便它们能够与GROUP BY子句兼容。
SQL_ERROR_INFO: "Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'er.score' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by"
SQL_ERROR_INFO: "Expression" 是 SQL 查询语句中的一个关键词,表示查询语句中的表达式或函数。当 SQL 查询语句中的表达式或函数出现错误时,会返回一个错误信息,其中包含 SQL_ERROR_INFO: "Expression" 的提示信息。这个提示信息可以帮助开发者快速定位 SQL 查询语句中的错误,并进行修复。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)