select 
round(avg(t.avg_amount1),1) avg_amount
,round(avg(t.avg_cost1),1) avg_cost
from
(
    select 
    uid
    ,min(event_time)
    ,avg(total_amount) avg_amount1
    ,sum(price*cnt)-avg(total_amount) avg_cost1

    from tb_order_detail de
    left join tb_order_overall ov 
    on  de.order_id=ov.order_id 
    where substring(event_time,1,7)='2021-10'
    group by 1
) t