with t as(
select month(fdate) as 'month',
row_number() over(partition by month(fdate) order by count(*) desc,song_id) as ranking,
song_name,
count(*) as play_pv
from play_log
join song_info using(song_id)
join user_info using(user_id)
where year(fdate)='2022'
and age>=18 and age<=25
and singer_name='周杰伦'
group by month(fdate),song_name,song_id
)
select *
from t where ranking<=3
区间取值,不可以用18<=age<=25,自测通过,提交不通过。
可以用age between 18 and 25,或者age>=18 and age<=25.

京公网安备 11010502036488号