题解 | #国庆接单3次及以上的司机统计信息#
2021年国庆在北京接单3次及以上的司机统计信息
https://www.nowcoder.com/practice/992783fd80f746d49e790d33ee537c19
select city, round(sum(cnt)/sum(total),3), round(sum(revenue)/sum(total),3) from( select '北京' as city, driver_id, count(distinct driver_id) as total, count(driver_id) as cnt, sum(fare) as revenue from tb_get_car_order as a left join tb_get_car_record as b on a.order_id = b.order_id where date(order_time) between '2021-10-01' and '2021-10-07' and city = '北京' group by 1,2 having cnt >= 3) as t group by 1