[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains
时间: 2023-09-27 12:09:40 浏览: 133
、和[3]引用的内容都是关于MySQL报错1055的问题。这个错误是由于在使用ORDER BY子句时,ORDER BY子句中的列没有在GROUP BY子句中,并且包含了不是在GROUP BY子句中的列,这与sql_mode=only_full_group_by选项不兼容所导致的。换句话说,这个错误是由于使用了不合法的ORDER BY子句。
要解决这个问题,可以有以下几种方法:
1. 修改SQL查询语句,确保ORDER BY子句中的列都在GROUP BY子句中,并且不包含不在GROUP BY子句中的列。这样可以确保查询语句符合sql_mode=only_full_group_by选项的要求。
2. 修改MySQL配置文件,将sql_mode选项中的only_full_group_by选项去掉。这样可以关闭只允许全面GROUP BY的模式,但需要注意这可能会导致其他潜在的问题。
3. 升级MySQL版本到5.7.5或更高的版本。从MySQL 5.7.5开始,sql_mode=only_full_group_by成为默认设置,不再允许ORDER BY子句中的非聚合列。
请根据具体情况选择适合的解决方法来解决[Err] 1055的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [MySQL异常:[Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nona...](https://download.csdn.net/download/weixin_38742656/13685329)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated...](https://blog.csdn.net/miachen520/article/details/122390084)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains](https://blog.csdn.net/qq_43514711/article/details/122041247)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文