[我正在尝试计算有多少条记录是由唯一的玩家[auth]完成的。因此,基本上,我正在尝试在每张地图上选择最短的时间,并计算出剩下的条目最多的人。
我在使用谷歌搜索功能时走得很远。
SELECT
auth,
map,
MIN(time) AS Record
FROM
bhop.playertimes
WHERE track LIKE '0'
GROUP BY
map
)
这成功列出了每张地图的最高记录时间和记录的[auth]。汇总[auth]条目的最简单方法是什么?
我希望这种类型的答案查询:
[auth] [records_made]
我认为您想要:
select p.auth, count(*) no_records
from bhop.playertimes p
where
p.track = 0
and p.time = (
select min(p1.time)
from bhop.playertimes p1
where p1.map = p.map and p1.track = 0
)
这给您每map
个拥有最短时间的auth
个数(据我所知,这是您对[所定义的auth
的定义。
rank()
获得相同的结果:select auth, count(*) no_records
from (
select auth, rank() over(partition by map order by time) rn
from bhop.playertimes
where track = 0
) p
group by auth