mysql5.7 group by syntax 1055

mysql5.7 group by syntax 1055

First look at the following statement to query the engine table that exists by default

 The MySQL version used before is below 5.7, and the execution statements are grouped according to support as follows

Add a field engine that has nothing to do with the group support

There is no problem

The current version is 5.7

After grouping according to support

1055-Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column'information_schema.ENGINES.ENGINE' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

meaning is

The SELECT list is not in the GROUP BY clause and contains the non-aggregated column'information_schema. engine. Functionally does not depend on the columns in the GROUP BY clause; this is not compatible with sql_mode=only_full_group_by

That is, the columns displayed by select must be related to group by

This is consistent with the oracle group by syntax, I have to say, it is more reasonable, of course, some viewing statements should be more complicated

View system variables sql.mode 


Modification method, edit my.ini in window, my.cnf in Linux, delete ONLY_FULL_GROUP_BY in [mysqld], and restart to solve!

Reference: mysql5.7 group by Grammar 1055-Cloud + Community-Tencent Cloud