with temp as ( select month(fdate) as month, count(p.song_id) as play_pv, song_name, row_number() over ( partition by month(fdate) order by count(p.song_id) desc, p.song_id ASC ) as ranking from play_log p join song_info s on p.song_id = s.song_id join user_info u on u.user_id = p.user_id where age > 17 and age < 26 and singer_name = '周杰伦' group by month(fdate), song_name, p.song_id ) select month, ranking, song_name, play_pv from temp where ranking < 4 order by month, play_pv desc;