题解 | #10月的新户客单价和获客成本#

10月的新户客单价和获客成本

http://www.nowcoder.com/practice/d15ee0798e884f829ae8bd27e10f0d64

select round(avg(avg_a),1) avg_amount,round(avg(avg_in-avg_a),1) as avg_cost from
(select uid,avg(total_amount) avg_a,sum(cnt*price) avg_in from
(select uid,event_time,tod.order_id,total_amount,cnt,price
from tb_order_detail tod,tb_product_info tpi,tb_order_overall too
where tod.product_id=tpi.product_id and tod.order_id=too.order_id
and (uid,event_time) in (select uid,min(event_time) from tb_order_overall group by uid))a
where left(event_time,7) like '2021-10'
group by uid
order by uid)b


全部评论

相关推荐

给🐭🐭个面试机会...:我擦seed✌🏻
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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