题解 | #2021年国庆在北京接单3次及以上的司机统计信息

2021年国庆在北京接单3次及以上的司机统计信息

https://www.nowcoder.com/practice/992783fd80f746d49e790d33ee537c19

select 
city,
round(avg(avg_order_num),3) as avg_order_num,
round(avg(avg_income),3) as avg_income
from
(   
    select 
    t1.city as city,
    t2.driver_id,
    round(count(t2.order_id),3) as avg_order_num,
    round(sum(t2.fare),3) as avg_income
    from tb_get_car_record t1
    left join tb_get_car_order t2
    on t1.uid = t2.uid
    and t1.order_id = t2.order_id
    where date(t1.event_time) between '2021-10-01' and '2021-10-07'
    and t1.order_id is not null
    and t1.city = '北京'
    group by t1.city,t2.driver_id
) t
where avg_order_num >= 3
group by city

一直在考虑要不要在where后面加一句and t2.fare is not null

结果就是 接了单 取消了 也算接单了 真就令人无语

全部评论

相关推荐

11-02 09:49
已编辑
货拉拉_测试(实习员工)
热爱生活的仰泳鲈鱼求你们别卷了:没事楼主,有反转查看图片
点赞 评论 收藏
分享
11-01 20:03
已编辑
门头沟学院 算法工程师
Amazarashi66:这种也是幸存者偏差了,拿不到这个价的才是大多数
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务