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

每个月Top3的周杰伦歌曲

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

select month,ranking,song_name,play_pv from(
select month,rank()over(partition by month order by month,play_pv desc,song_id) ranking,song_name,play_pv from(
select month,play_pv,b.song_id,song_name,singer_name from(
select month,count(*) play_pv,song_id from(
select month(fdate) month,p.song_id,p.user_id
from play_log p 
left join user_info u on u.user_id = p.user_id
where fdate like '2022%' and age between 18 and 25 
)a
group by month,a.song_id
)b
left join song_info s on b.song_id = s.song_id
)c where singer_name = '周杰伦'
)d where ranking between 1 and 3


全部评论

相关推荐

头像
10-16 09:58
已编辑
门头沟学院 Java
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务