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

tags: MySQL

Original link: https://blog.csdn.net/loveliness_peri/article/details/88051316

It is because only_full_group is configured in sql_mode in the default MySQL configuration, which requires GROUP BY 
 Contains all the fields that appear in the SELECT.

 only_full_group_by description:
 only_full_group_by: To use this is to use the same group rules as Oracle, 
 The select column must be in the group, or it is an aggregate column (SUM, AVG, MAX, MIN).
 In fact, this configuration currently personally feels similar to distinct, so just remove it

 

SELECT * FROM table name GROUP BY field

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_mode=only_full_group_by

The reason for the problem: there are more in sql_mode:ONLY_FULL_GROUP_BY

Use SQL statements to query this configuration:

select @@sql_mode;

Solution: Add the corresponding setting in the configuration file: (is to execute the query sql_mode statement above; removeONLY_FULL_GROUP_BYCan)

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

 

 

 

Intelligent Recommendation

mysql error: this is incompatible with sql_mode=only_full_group_by

Solution: modify the mysql configuration file The local server can modify this Add under [mysqld] Then restart service mysql restart  ...

MySQL error: this is incompatible with sql_mode = only_full_group_by

Error scenario Today, I have a project that I just came down on my computer. When I log in to enter the home page, I reported a string of this is incompatible with sql_mode = only_full_group_by error,...

MySQL error [this is incompatible with sql_mode = only_full_group_by]

Report error message: Reporting error Mysql 5.7.5 and above function dependencies. If ONLY_FULL_GROUP_BY is enabled SQL Mode (By default), MySQL will refuse to select a list, the Having condition, or ...

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...

More Recommendation

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 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...

[2020.5] Mac mysql installation configuration file my.cnf (1055 "this is incompatible with sql_mode=only_full_group_by" error)

Recently Mysql prompts an error when using groupby query1055 this is incompatible with sql_mode=only_full_group_by I checked N posts and found that after MySQL 5.7.5, ONLY_FULL_GROUP_BY was turned on ...

Solve the Group By statement error: this is incompatible with sql_mode = only_full_group_by

Today I wrote such a SQL statement in Mysql on my personal server: The execution even reported an error, the error information is as follows: My Mysql version is 5.7.22, which was newly installed when...

MySQL: Error Error 1055 (42000) SQL_Mode = only_Full_group_by

environment Execute the query statement Report an error reason: MySQL 5.7.5 and above functions rely on detection function Solution After setting, if it does not take effect, you can exit and log in a...

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

Top