Mysql Error: 1140 – In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column ‘’; this is incompatible with sql_mode=only_full_group_by

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.

As long as there are aggregation functions sum(), count(), max(), avg() and other functions, group by needs to be used

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *