题解 | #零食类商品中复购率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;

全部评论

相关推荐

点赞 评论 收藏
分享
Gaynes:查看图片
点赞 评论 收藏
分享
05-26 10:24
门头沟学院 Java
qq乃乃好喝到咩噗茶:其实是对的,线上面试容易被人当野怪刷了
找工作时遇到的神仙HR
点赞 评论 收藏
分享
万一背调了怎么办,这不就是毁了一个大学生嘛 这帮人为了挣钱真是没有底线了
程序员小白条:最近牛客看到很多,还有牛友跟我私信,团伙组织了,属于是
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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