题解 | #国庆接单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

全部评论

相关推荐

重生我想学测开:嵌入式的问题,我准备入行京东外卖了
点赞 评论 收藏
分享
xwqlikepsl:感觉很厉害啊,慢慢找
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务