select city,round(avg(num),3) as avg_order_num , round(avg(sum1),3) as avg_income from ( select driver_id,city,count(*) as num ,sum(fare) as sum1 from tb_get_car_record join tb_get_car_order using(order_id) where city='北京' and date(order_time) between '2021-10-1'and '2021-10-7' group by driver_id ,city having count(*)>=3 )t group by city
接单就算
注意条件,北京、国庆 ,接单量>=3