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

每个月Top3的周杰伦歌曲

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

select
month
,rn as ranking
,song_name
,play_pv
from(
select 
month(fdate) as month
,a.song_id as  song_id
,b.song_name as song_name
,count(1) as play_pv
,row_number() over(partition by month(fdate) order by count(a.song_id) desc,b.song_id) as rn
from play_log a
left join song_info b
on a.song_id = b.song_id
left join user_info c
on a.user_id = c.user_id
where left(a.fdate,4) = '2022'
and c.age  between 18 and 25
and b.singer_name = '周杰伦'
group by 1,2,3) as tmp
where rn<=3
order by month, ranking;

全部评论

相关推荐

06-20 15:23
门头沟学院 Java
难道你们背八股都不觉得累?现在每天背八股背的我想吐
想去大厂的土豆子:累不累都是对比出来的,八股可比高考、考研轻松多了
点赞 评论 收藏
分享
点赞 评论 收藏
分享
05-22 12:44
已编辑
门头沟学院 golang
点赞 评论 收藏
分享
06-19 13:40
武汉大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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