题解 | #10月的新户客单价和获客成本#
10月的新户客单价和获客成本
http://www.nowcoder.com/practice/d15ee0798e884f829ae8bd27e10f0d64
select round(sum(total_amount)/ count(order_id),1),round(sum(p_2)/ count(order_id),1) from tb_order_overall left join (select order_id,-(total_amount-p_1) p_2 from tb_order_overall left join (select order_id,sum(price) p_1 from tb_order_detail left join tb_order_overall using(order_id) where date_format(event_time,'%Y-%m')='2021-10' group by order_id )tb_1 using(order_id) where date_format(event_time,'%Y-%m')='2021-10' )tb_2 using(order_id) where date_format(event_time,'%Y-%m')='2021-10' #测试正确,运行出错! #把 sum(total_amount),sum(p_2) 都没问题
