题解 | 2021年国庆在北京接单3次及以上的司机统计信息
2021年国庆在北京接单3次及以上的司机统计信息
https://www.nowcoder.com/practice/992783fd80f746d49e790d33ee537c19
select city ,round(avg(cnt),3) as avg_order_num ,round(avg(m),3) as avg_income from( select city ,count(order_time) as cnt #接单数量 ,sum(if(fare is null,0,fare)) as m #钱钱 from tb_get_car_record tr right join tb_get_car_order tgo on tr.order_id=tgo.order_id where date_format(order_time,'%Y-%m-%d') between '2021-10-01' and '2021-10-07' and city='北京' group by driver_id ) t1 where cnt>=3 group by city
需要注意的是接单次数,接了单,但是用户取消了订单,接单次数依旧有效