题解 | 每个月Top3的周杰伦歌曲

每个月Top3的周杰伦歌曲

https://www.nowcoder.com/practice/4ab6d198ea8447fe9b6a1cad1f671503

select * from 
(select 
c.month,
row_number() over ( partition by c.month order by c.play_pv DESC) as ranking,
d.song_name,
c.play_pv
from (
select MONTH(a.fdate) as month , a.song_id,count(*) as play_pv 
from play_log as a
left outer join  user_info as b
on a.user_id=b.user_id	
where b.age between 18 and 25 
group by  MONTH(a.fdate),a.song_id) as c
left outer join song_info as d
on c.song_id=d.song_id
where d.singer_name = '周杰伦'
) as ranked 
where ranked.ranking <=3

全部评论

相关推荐

算法丰川祥:实际就两个人给他投,它这么说好显得自己比较抢手
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务