# 歧义点:被取消的单也算是司机接单了,所以国庆期间应该用event_time做限定!
select '北京',round(count(*)/count(distinct t1.driver_id),3),
round(sum(t1.fare)/count(distinct t1.driver_id),3) from (
select o1.driver_id,r1.city,o1.fare
,count(*) over(partition by o1.driver_id) as cnt from 
tb_get_car_order as o1 left join tb_get_car_record as r1 
on o1.order_id = r1.order_id 
where date_format(r1.event_time,'%Y-%m-%d') between '2021-10-01' and '2021-10-07'  
and r1.city = '北京'
) t1 where t1.cnt >= 3