题解 | #有取消订单记录的司机平均评分#

有取消订单记录的司机平均评分

https://www.nowcoder.com/practice/f022c9ec81044d4bb7e0711ab794531a

select 
    driver_id 
    ,round(avg(grade) ,1) avg_grade
from 
    tb_get_car_order   
where 
    driver_id 
in (
        select 
    driver_id 
from 
    tb_get_car_order 
where 
    start_time is null 
and 
 substring(order_time,1,7)='2021-10'
    )
group by 
    driver_id
union all 
 select 
    '总体' as driver_id
    ,round(avg(grade),1) avg_grade
from 
    tb_get_car_order   
where 
    driver_id 
in (
        select 
    driver_id 
from 
    tb_get_car_order 
where 
    start_time is null 
and 
 substring(order_time,1,7)='2021-10'
    )

全部评论

相关推荐

听说改名字就能收到offer哈:Radis写错了兄弟
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务