题解 | #广告点击率排名#

广告点击率排名

https://www.nowcoder.com/practice/489a4e583a4549ba8d788212469276e6

with tiaojian as (
select 
t.uid,
t.m
from(
select 
uid,
count(rid) as cnt,
rank()over(order by sum(is_click)/count(rid) desc,uid desc) as m
from  user_res_event_log_tb
where date_format(event_date,'%Y-%m')='2022-07'  
and rid like 'ad%'
group by uid
) as t 
where
t.m<=3
),tiaojian1 as (
select 
uid,
round(
sum(is_click)/count(rid),3) as ctr_2208,
rank()over(order by sum(is_click)/count(rid) desc,uid desc) as m
from  user_res_event_log_tb
where date_format(event_date,'%Y-%m')='2022-08'  
and rid like 'ad%'
group by uid
)


select 
t1.uid,
t1.ctr_2208,
t1.m as rk_ctr
from tiaojian1 t1   join tiaojian t on t.uid=t1.uid
order by t1.uid

全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 11:27
明天又是董事长面,啥时候是个头啊
积极向上的林同学:董事长亲自面试
点赞 评论 收藏
分享
程序员小白条:你是沟通了900个,不是投了900份简历,你能投900份,意味着对面都要回复你900次,你早就找到实习了,没亮点就是这样的,别局限地区,时间投的也要早,现在都要7月了
点赞 评论 收藏
分享
北漂的牛马人:211佬,包进的,可能是系统问题
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务