SELECT list is not in GROUP BY clause and contains nonaggregated column

A super detailed tutorial: springboot integrates mybatis plus>>>

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mer_cash.m.head_portrait' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

MySQL 5.7.5 and above functions rely on the detection function. If only is enabled_ FULL_ GROUP_ By SQL mode (by default), MySQL will reject queries that select lists, having conditions, or order by lists, refer to non collection columns that are neither named nor functionally dependent on them in the group by clause

The best solution is to optimize SQL: use any_ The value function returns any value

You can also modify the configuration of the database to remove only in the configuration file of the database_ FULL_ GROUP_ By this value

Modify my.cnf configuration. If there is no configuration item, add one as follows

sql_ mode=STRICT_ TRANS_ TABLES,NO_ ZERO_ IN_ DATE,NO_ ZERO_ DATE,ERROR_ FOR_ DIVISION_ BY_ ZERO,NO_ AUTO_ CREATE_ USER,NO_ ENGINE_ SUBSTITUTION

Similar Posts: