mysql error solution sql_mode=only_full_group_by

ql statement error

#1055 - Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘cash.sdb_login_log.id‘ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

###

 

Workaround for official documentation

https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-setting

 

Query mysql server version:
select @@version
Display:
5.7.10
select @@GLOBAL.sql_mode;
Display result:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

#View the syntax of
sql_mode select @@GLOBAL.sql_mode;
select @@SESSION.sql_mode;

#Modify the syntax of sql_mode, remove ONLY_FULL_GROUP_BY, and reset the model

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‘;
SET SESSION sql_mode = ‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION‘;
或者 

 

Non-global mode: set @@sql_model='';

Global mode: set @@GLOBAL.sql_mode='';

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326069944&siteId=291194637