sql_mode = only_full_group_by group by query error caused the problem

Group by using a query in Mysql when the following error occurs:

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'GT_SIGNATURE_STU.SINGN_STU_ID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

In the error was found, it has a problem sql_mode = only_full_group_by. Found by looking for the pattern must have a column corresponding to the aggregate function.

 

Referring specifically to:https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

About sql_mode introduction, see the following description:

MySQLA reasonable set of sql_mode

sql_mode is easily overlooked variable, the default value is a null value, in this arrangement is to allow some illegal operations, such as allowing some invalid data is inserted. This value must be set in a production environment for strict mode, developers,testenvironmentaldatabaseIt must also be set so that the development and testing stage can be found problems
  
sql_mode common values ​​are as follows: 
ONLY_FULL_GROUP_BY:

For GROUP BY aggregate operations, if a column in the SELECT, does not appear in a GROUP BY, then the SQL is not legitimate, because the column is not in the GROUP BY clause


NO_AUTO_VALUE_ON_ZERO:

The value is inserted from the impact of the growth column. In the default setting, the insert 0 or NULL on behalf of a self-generated growth value. If you want to insert a value of 0, and that column is self-growth, this option comes in handy.


STRICT_TRANS_TABLES:

In this mode, if a value can not be inserted into a transaction table, interrupting the current operation, no limitation on the non-transactional table

NO_ZERO_IN_DATE:

In strict mode, the date and month of zero is not allowed


NO_ZERO_DATE:

This value is set, mysql database does not allow zero-insertion date, insert zero dates will throw an error instead of a warning.


ERROR_FOR_DIVISION_BY_ZERO:

INSERT or UPDATE in the process, if the data is zero, an error instead of a warning is generated. If this mode is not given, then return NULL when data MySQL zero


NO_AUTO_CREATE_USER:

GRANT prohibit users create a blank password


NO_ENGINE_SUBSTITUTION:

If you need a storage engine is disabled or not compiled, then throw an error. When this value is not set, the default storage engine replacement, and throws an exception


PIPES_AS_CONCAT:

The "||" operator not regarded as connection strings or operators, and thisOracleThe database is the same, and also blending functions similar string Concat


ANSI_QUOTES:

ANSI_QUOTES then enabled, can not be used to refer to a string double quotation marks, because it is interpreted as an identifier

 

Intelligent Recommendation

mysql5.7 query error this is incompatible with sql_mode = only_full_group_by

The server is running normally, and an error occurs when the machine is running Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘mgl.db_mglmro_customer_c...

MYSQL8.0 sort query error this is incompatible with sql_mode=only_full_group_by

Edit the mysql configuration file (windows is my.ini, linux is my.cnf), add the following configuration under [mysqld]:   Just restart the MySQL service...

Mysql Query "this is incompatible with sql_mode = only_full_group_by" error

problem When deploying a server-deployed server, the original SQL statement has appeared "this is incompatible with sql_mode = only_full_group_by" error. reason After mysql5.7.5, the default...

MySql version changes, and an error is reported when using group by for group query sql_mode=only_full_group_by

1. Reason of error After MySQL 5.7.5, only_full_group_by becomes one of the default options of sql_mode, which may cause some SQL statements to fail. For example, when group by is used for group query...

sql_mode -- pondering caused by ONLY_FULL_GROUP_BY

Because I changed the computer, I set up the environment again, and reported an error when querying the database: Expression #1 of ORDER BY clause is not in SELECT list, references column ‘a.coo...

More Recommendation

MySQL uses group by error SQL_MODE = only_full_group_by modifies SQL_MODE in Session in Navicat

Check SQL_MODE results returned by mysql8 Remove the only_full_group_by this SQL_Mode, the operation is as follows: Then execute the SQL statement will not report an error, this is just modifying SQL_...

Import data error SQL_MODE = ONLY_FULL_GROUP_BY problem

Import SQL file error SQL_MODE = ONLY_FULL_GROUP_BY error when using Group BY statement query   Baidu solution:   The first one (I tried the first kind, perfect solution) Execute SQL stateme...

MySQL5.7 Error This Is Incompatible with SQL_MODE = Only_Full_Group_by problem solving

CentOS7 environment mysql5.7 execution GROUP statement Error: SELECT list is not in GROUP BY clause and contains nonaggregated column '***' which is not functionally dependent on columns in GROUP BY c...

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

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 () fu...

mysql query error caused by only_full_group_by

1. The cloud cause of the problem After MySQL 5.7.5, ONLY_FULL_GROUP_BY is turned on by default, so some of the previous SQL cannot be executed normally. In fact, it is caused by our SQL irregularitie...

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

Top