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

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

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

我的笨办法:用union all 实现

select driver_id,round(avg(grade),1)as avg_grade

from tb_get_car_order

where driver_id in

(select driver_id

from tb_get_car_order

where month (order_time)=10

and start_time is null)

and grade is not null

group by 1

union all

select "总体" as driver_id,round(avg(grade),1)as avg_grade

from tb_get_car_order

where driver_id in

(select driver_id

from tb_get_car_order

where month (order_time)=10

and start_time is null)

and grade is not null;

全部评论

相关推荐

不愿透露姓名的神秘牛友
11-20 19:57
已编辑
某大厂 golang工程师 23.0k*16.0, 2k房补,年终大概率能拿到
点赞 评论 收藏
分享
10-10 17:54
点赞 评论 收藏
分享
牛客154160166号:9月底还给我发短信,好奇怪,我24届的
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务