题解 | 每个月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