mysql - having 子句中的最大计数

标签 mysql count max having-clause

我必须找到最先出现的 Actor 。

独奏(歌剧、 Actor 、角色、出场顺序)

我试过这种方式:

select distinct R1.Actor, count(R1.Actor) as nro
from Recital R1
where R1.AppOrd='1'
group by Actor
having max(nro)

但它返回一个空表。 谢谢。

最佳答案

这将显示最佳 Actor ,但是如果出现平局,则只会显示其中一位 Actor :

select R1.Actor, count(R1.Actor) as nro
from Recital R1
where R1.AppOrd='1'
group by R1.Actor
ORDER BY nro DESC
LIMIT 1;

关于mysql - having 子句中的最大计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14880549/

相关文章:

c# - 从下拉列表中选择数据

php - 无法在函数 PHP 中获取数组

MySQL文件导入

php - 输入CSV文件并将其上传到MySQL DB

python - 计数 1's in a n x n array of 0' 和 1

mongodb - Mongos 计数项目不是真实的?

java - 统计特定列sql中出现的特定值的数量

python - 获取列表中最大值对应的变量名称

mysql - 使用连接不返回行选择最大值

c - 我有一个函数,它有 int a 和 int b 我所要做的就是找到最大值