According to the information,
group by has been optimized after MySQL 5.7. The version after the default startup improvement enables ONLY_FULL_GROUP_BY mode.
That is, ONLY_FULL_GROUP_BY is a sql_mode provided by the MySQL database, and this sql_mode is used to ensure the validity of the SQL statement “grouping for the most value”. This mode adopts the processing method with databases such as Oracle and DB2. That is, columns with ambiguous semantics are not allowed in the select target list.
Solution:
As long as there are aggregation functions sum(), count(), max(), avg() and other functions, group by needs to be used
Similar Posts:
- [Solved] MYSQL Command gruop by Error: this is incompatible with sql_mode=only_full_group_by
- [Solved] SELECT list is not in GROUP BY clause and contains nonaggregated
- SELECT list is not in GROUP BY clause and contains nonaggregated column
- [Solved] MySQL Error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre
- SELECT list is not in GROUP BY clause and contains nonaggregated
- [Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- Hive SemanticException:Expression not in GROUP BY
- [Solved] MYSQL8 group by Error: Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY
- You can’t specify target table for update….
- Laravel uses group by to report errors [How to Solve]