Mysql中group by的问题。。

查看:108
本文介绍了Mysql中group by的问题。。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

Mysql中,下面这样的写法是可以允许的。但是严不严谨,支不支持这样写?有疑惑过不去这个坎,请大家帮忙看看。

select * from user group by user_name;

解决方案

最详细的文档说明在官网找到了。

MySQL 5.7.5 and up implements detection of functional dependence. If the ONLY_FULL_GROUP_BY SQL mode is enabled (which it is by default), MySQL rejects queries for which the select list, HAVING condition, or ORDER BY list refer to nonaggregated columns that are neither named in the GROUP BY clause nor are functionally dependent on them. (Before 5.7.5, MySQL does not detect functional dependency and ONLY_FULL_GROUP_BY is not enabled by default. For a description of pre-5.7.5 behavior, see the MySQL 5.6 Reference Manual.)

来源:https://dev.mysql.com/doc/ref...

这篇关于Mysql中group by的问题。。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆