题解 | #2021年国庆在北京接单3次及以上#
2021年国庆在北京接单3次及以上的司机统计信息
https://www.nowcoder.com/practice/992783fd80f746d49e790d33ee537c19
select
'北京' as city,
round(avg(cnt),3) as avg_order_num,
round(avg(sumfare) ,3)as avg_income
from (select
driver_id,
count(*) as cnt,
sum(fare) as sumfare
from (select o.driver_id,o.fare
from tb_get_car_record r join tb_get_car_order o
on r.order_id = o.order_id where r.city = '北京' and o.finish_time between '2021-10-01' and '2021-10-07') t group by driver_id having count(*) >= 3) p
- finish_time between '2021-10-01' and '2021-10-07'
- having count(*) >= 3
- city = '北京'

