关于mysql5.7的sql_mode=only_full_group_by

MySQL对于ONLY_FULL_GROUP_BY语义的判断规则是,如果group by list中的表达式是basic column,那么target list中允许出现表达式是group by list中basic column或者alias column的组合结果,如果group by list中的表达式是复杂表达式(非basic column或者alias column),那么要求target list中的表达式必须能够严格和group by list中的表达式进行匹配,否者这条查询会被认为不合法。

就是说Group by 使用的时候,要查询的字段,必须出现在group by 后面的字段,或者出现在where子句中

参考自:http://www.ywnds.com/?p=8184

猜你喜欢

转载自blog.csdn.net/Pruett/article/details/81386884