MySQL uses group by to report an error sql_mode=only_full_group_by

tags: Mysql

mysql opens only_full_group_by mode. In this mode, using the old version of mysql to get group by group data will report an error, the error is as follows:
`Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘wenming-bj-mtg.comments.organization_id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Time: 0s`

The ONLY_FULL_GROUP_BY configuration enables "strict ANSIsql rules". The strict ANSI sql rules require that there are no aggregated columns when group by. When group by, all must be included in the field of group by.

Without turning off the ONLY_FULL_GROUP_BY mode, the columns that do not use aggregate functions will be connected to the fields that need group by. The sql is as follows:

SELECT obj_id, area_id, organization_id, stars FROMcommentsWHEREarea_3= 2424 ANDtype= 2 ANDenabled= 1 ANDcreated_at>= '2020-05-02 00:00:00' ANDcreated_at<= '2020-07-22 16:00:00' GROUP BY obj_id,organization_id,area_id,stars


That's it, if it helps you, please click ha.

Intelligent Recommendation

MySQL error: # 1 of ORDER BY clause is not in GROUP BY sql_mode = only_full_group_by

During MySQL operation, the following errors are often reported: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PRO...

MySQL is using group by query error this is incompatible with sql_mode=only_full_group_by

The specific errors are as follows: the reason: MySQL 5.7.5 and above functions depend on the detection function. If ONLY_FULL_GROUP_BY SQL mode is enabled (by default), MySQL will reject select lists...

MySQL query error: ORDER BY clause is not in GROUP BY.. this is incompatible with sql_mode=only_full_group_by

my situation : Mysql 5.7.21 version runs sql and reports the same error. The same sql runs directly locally without error. However, this error occurs when connecting to Mysql on the server (even runni...

Mysql Group by error: 1055-Expression #1GROUP BY this is incompatible with sql_mode=only_full_group_by

Original link: https://blog.csdn.net/loveliness_peri/article/details/88051316   The reason for the problem: there are more in sql_mode:ONLY_FULL_GROUP_BY Use SQL statements to query this configur...

More Recommendation

Solution: MySQL Error 1055: Group by clause; this is incompatible with sql_mode = only_full_group_by

When using MySQL to perform Group By query statement, error: problem causes The SQL standard does not allow the Select list, a Having condition statement, or a grouse in the Group By in the Order by s...

MySQL error: in aggregated query without group by, incompatible with sql_mode = only_full_group_by

Scenario: The same product, different models, there are different prices, such as 1 mobile phone has 128G, 2,256g, 2500 yuan, but the product display page, the price shows 2,000 yuan, if it is a produ...

MYSQL high version with group by error-sql_mode = only_full_group_by solution

Database removing duplicate data, the data needs to be packed and one of them is displayed. The group by statement may be used. However, if MySQL is above 5.7 or more, when the group by is executed, i...

About mysql to report sql_mode = only_full_group_by

Erusion page information Probably means: grammatical errors or access conflict, the expression is not in the conditions of group by, and this is withsql_mode=only_full_group_byIncompatible This error ...

mysql group sql_mode=only_full_group_by issue

1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'XXX' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_m...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top