题解 | #广告点击率排名#
广告点击率排名
https://www.nowcoder.com/practice/489a4e583a4549ba8d788212469276e6
select * from (select uid, ctr_2208,rank() over(order by ctr_2208 desc,uid desc) as rk_ctr from (select uid,round(sum(is_click)/count(is_click),3) as ctr_2208 from user_res_event_log_tb where rid like 'ad%' and month(event_date) = 8 and year(event_date) =2022 group by uid order by ctr_2208 desc,uid desc) t2 ) t3 where uid in (select uid from (select uid,sum(is_click)/count(is_click) as ctr1 from user_res_event_log_tb where rid like 'ad%' and month(event_date) = 7 and year(event_date) =2022 group by uid order by ctr1 desc,uid desc limit 3) t1) order by uid