题解 | #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

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

全部评论

相关推荐

面向对象的火龙果很爱...:去吃一顿炸鸡就走
点赞 评论 收藏
分享
求offer的大角牛:不吃香菜
点赞 评论 收藏
分享
06-19 19:06
门头沟学院 Java
码农索隆:别去东软,真学不到东西,真事
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
昨天 11:29
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务