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

with T as(
    select month(A.fdate)as month,B.song_id,B.song_name,count(*)as play_pv from play_log A,song_info B,user_info C 
        where A.user_id=C.user_id and A.song_id=B.song_id and 
              C.age between 18 and 25 and 
              B.singer_name='周杰伦' and year(A.fdate)=2022 group by month,B.song_name,B.song_id)
select * from(select month,row_number()over(partition by month order by play_pv desc,song_id)as ranking,song_name,play_pv  from T)R WHERE ranking<=3

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-16 18:03
点赞 评论 收藏
分享
码农索隆:想看offer细节
点赞 评论 收藏
分享
星辰再现:裁员给校招生腾地方
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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