题解 | #点击率排名与转化率排名差异#

点击率排名与转化率排名差异

https://www.nowcoder.com/practice/45edb549dffd45aa9de9f31b79ec80b9

with k as(select t3.uid,ctr,cvr,rk1,rk2 from
(select uid,ctr,row_number()over(order by ctr desc) as rk1 from (select uid,round(sum(is_click)/count(is_click),3) as ctr 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 desc,uid desc) t1) t3
inner join
(select uid,cvr,row_number()over(order by cvr desc) as rk2 from (select uid,round(sum(case when is_click=1 then is_convert else 0 end)/sum(is_click),3) as cvr 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 cvr desc,uid desc) t2) t4 using(uid))
select uid,abs(cast(rk1 as signed)-cast(rk2 as signed)) as diff,ctr,cvr from k order by diff desc,uid desc limit 2

全部评论

相关推荐

10-07 20:48
门头沟学院 Java
不敢追175女神:可能是实习上着班想到后面还要回学校给导师做牛马,看着身边都是21-25的年纪,突然emo了了
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务