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

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

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

select driver_id,round(avg(grade),1) as avg_grade
from (select driver_id,grade
from tb_get_car_order where start_time is not null and driver_id in (select 
    o.driver_id
from tb_get_car_record r join tb_get_car_order o 
on r.order_id = o.order_id where left(event_time,7) = '2021-10' and start_time is null) ) t group by driver_id
union
select '总体' as driver_id,round(avg(grade),1) as avg_grade from (select driver_id,grade
from tb_get_car_order where start_time is not null and driver_id in (select 
    o.driver_id
from tb_get_car_record r join tb_get_car_order o 
on r.order_id = o.order_id where left(event_time,7) = '2021-10' and start_time is null) )p

写得像史

全部评论

相关推荐

10-09 09:39
门头沟学院 C++
HHHHaos:这也太虚了,工资就一半是真的
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
11-27 10:48
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务