Tag Archives: MySQLExpression #1 of SELECT list is not in GROUP BY clause and contains nonaggre

[Solved] MySQL Error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre

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

Solution:

Firstly Use SQL to find:

select @@global.sql_mode

Remove only_FULL_GROUP_By, and then reset the value (fill in the cropped string in quotation marks)

set @@global.sql_mode='';
The values you find is the below:

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