题解 | #零食类商品中复购率top3高的商品#

零食类商品中复购率top3高的商品

https://www.nowcoder.com/practice/9c175775e7ad4d9da41602d588c5caf3

select product_id,round(sum(cct)/count(uid),3)repurchase_rate
from 
(select uid,product_id,if(count(uid)>1,1,0) as cct
from
(select t1.product_id,event_time,uid,max(event_time)over() as max_dt
from tb_order_detail as t1 left join tb_order_overall as t2
on t1.order_id=t2.order_id
left join tb_product_info t3
on t1.product_id=t3.product_id
where tag="零食"and status=1)a 
where datediff(max_dt,event_time)<=89
group by uid,product_id)b
group by product_id
order by repurchase_rate desc ,product_id
limit 3

全部评论

相关推荐

程序员小白条:你是沟通了900个,不是投了900份简历,你能投900份,意味着对面都要回复你900次,你早就找到实习了,没亮点就是这样的,别局限地区,时间投的也要早,现在都要7月了
点赞 评论 收藏
分享
美团的笔试怎么都是大模型
Wayne_AI4S:这是经典机器学习的知识点
投递美团等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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