select
t.city,
round(avg(t.order_num),3) as avg_order_num,
round(avg(t.fare_sum),3) as avg_income
from
(select
tgcr.city,
tgco.driver_id,
count(tgco.order_id) as order_num,
sum(tgco.fare) as fare_sum
from
tb_get_car_order tgco
left join
tb_get_car_record tgcr on tgco.order_id = tgcr.order_id
where
date_format(tgcr.event_time,'%Y-%m-%d') between '2021-10-01' and '2021-10-07'
group by
1,2
having
count(tgco.order_id) >= 3) t
group by
1



京公网安备 11010502036488号