[Mysql] SQL statement group query encountered error: this is incompatible with sql_mode = only_full_group_by, compatibility solving

tags: Database related  SQL statement  mysql  database  java

This problem occurs above Mysql5.7 because the default SQL configuration is: SQL_MODE = "Only_Full_Group_by".


If it is developed directly on 5.7, it is recommended to use the Any_Value () function.

select 
	t.category_no, any_value(t.game_name)
from 
	t_game t
group 
	t.category_no

Change configuration method

  1. First method, temporary, restart failure
set @@GLOBAL.sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
  1. The second method, modify the configuration file, permanent
    Open my.cnf Profile

Add this paragraph below [MySQLD] and [MySQL]

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Restart the database service

Intelligent Recommendation

mysql error this is incompatible with sql_mode = only_full_group_by

mysql5.7 + version is turned on by defaultonly_full_group_byMode,When you turn on this mode, the column must query conditions are grouped. The original group by statement will be reported this error. ...

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

Report error using group by statement:...this is incompatible with sql_mode=only_full_group_by

Problem background When using leftjion to connect a table to the left, and the primary and secondary tables are one-to-many, resulting in duplicate data in the result set, in order to remove duplicate...

More Recommendation

Mysql8 execution SQL statement error "this is incompatible with sql_mode=only_full_group_by"

WIN10 my.ini configuration: [mysqld] sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION" After restarting mysql, query select @@sql_...

MySQL8 executes SQL statement error "this is incompatible with sql_mode=only_full_group_by"

Reason for error: In mysql8.0 and above, for this aggregation operation of group by, if the column in the select does not appear in the group by, then this SQL is illegal, because the column is not in...

MySQL Query: Order by Clause Is Not in Group by..this is incompatible with sql_mode = only_full_group_by

When using MySQL, the following query is performed: The error message is as follows: The wrong reason is that my mysql version is 5.7, using the following statement query you know It is set by default...

MySql: In aggregated query without GROUP BY...;this is incompatible with sql_mode=only_full_group_by

wrong reason This is caused by the version features above MySQL5.7. solution Execute the following code Run and then you can, finish....

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

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

Top