在Mysql下使用Group by查询的时候会出现如下错误:
1 | Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'GT_SIGNATURE_STU.SINGN_STU_ID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by |
在上述的错误中发现,其有一个sql_mode=only_full_group_by
的问题。通过查找发现该模式对应的列必须有个聚合函数。
具体参见: https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
关于sql_mode的介绍,参见如下介绍:
1 | MySQL的sql_mode合理设置 |