Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of the method of handling 1055 errors reported by MySQL 5.7using group by statements

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces MySQL 5.7Using group by statements to report 1055 error handling methods. I hope I can add and update some knowledge to you. If you have any other questions you need to know, you can continue to follow my updated articles in industry information.

1. When grouping with group by statements in mysql version 5.7 or later, this error will be reported if the field of select is not exactly the corresponding field after the group by, and there are other fields.

ERROR 1055 (42000): Expression # 1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

two。 This is because the higher version of mysql adds a sql_mode.

View sql_mode

Select @ @ sql_mode

Mysql > select @ @ sql_mode

+- -+

| | @ @ sql_mode |

+- -+

| | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_pISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |

+- -+

You can see that there is an ONLY_FULL_GROUP_BY, which strictly controls the group by and select fields. You can remove this without changing the sql statement.

3. Edit this file / etc/mysql/conf.d/mysql.cnf under my ubuntu system, and other systems can find the corresponding configuration file. Under the [mysqld] block, configure sql_mode and remove ONLY_FULL_GROUP_BY.

Sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_pISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

4. It's normal at this time.

Related tutorials: mysql Video tutorial

These are the details of the 1055 error caused by using the group by statement on MySQL 5.7. please pay attention to other related articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report