Error Messages
Expression #2 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
cause
MySQL 5.7.5 and more functional dependency detection. If ONLY_FULL_GROUP_BY SQL mode is enabled (default), MySQL will refuse to select a list of query conditions or ORDER BY HAVING a list of references to non-aggregate column in the GROUP BY clause is neither named nor on their functionality. (Prior to 5.7.5, MySQL does not detect functional dependencies, is not enabled by default ONLY_FULL_GROUP_BY. For a description of the behavior before 5.7.5, see "MySQL 5.6 Reference Manual.")
Solution
select @@global.sql_mode
Results
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
carried out
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’;
Successfully resolved