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

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

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

select product_id,round(sum(if(cnt=2,1,0))/count(),3) rate from ( select product_id,uid,count() cnt from ( select overall.uid,info.product_id from tb_order_detail detail join tb_order_overall overall on detail.order_id = overall.order_id and overall.status = 1 and event_time >= ( SELECT DATE_SUB(MAX(event_time), INTERVAL 89 DAY) FROM tb_order_overall ) join tb_product_info info on info.product_id = detail.product_id and info.tag = '零食' )t1 group by product_id,uid )t2 group by product_id order by rate desc,product_id limit 3;

全部评论

相关推荐

存一千万就可以进大厂实习
石圪节公社发型师:有存一千万的实力还实习个嘚,直接躺平
点赞 评论 收藏
分享
后来123321:别着急,我学院本大二,投了1100份,两个面试,其中一个还是我去线下招聘会投的简历,有时候这东西也得看运气
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务