this is incompatible with sql_mode=only_full_group_by
MySQL版本5.7.14;
SQL语句:
mysql> SELECT id,sex,age FROM users_0 GROUP BY age;
ERROR:
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'testdb.users_0.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
似乎在SELECT后的字段必须全部出现在GROUP BY之后,否则都会出现以上错误.
请问什么原因,如何解决?