According to the documentation ,在 MySQL 中,Max() 和 Min() 聚合函数接受一个 DISTINCT 关键字:
The DISTINCT keyword can be used to find the maximum of the distinct values of expr, however, this produces the same result as omitting DISTINCT.
也许我遗漏了什么,但这怎么会有用呢?
更新:
与几个答案相反,MySQL 不支持每个聚合函数的不同。
avg()、count()、min()、max()、group_concat() 和 sum() 支持 Distinct。它不支持 std()、variance()、其他几个统计函数或按位聚合函数。
最佳答案
它们像所有聚合一样采用 DISTINCT,但是,当您追求最大值时,可能存在多个值这一事实是无关紧要的,因此它总是相同的。
Count 是 distinct 会产生不同结果的关键示例。
关于mysql - MySQL 中的 Max(distinct...)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/543964/