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

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

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

	(select
t.driver_id driver_id,
round(sum(t.grade)/count(1), 1) avg_grade
from
tb_get_car_order as t right join 
(select driver_id from tb_get_car_order where date_format(order_time,'%Y-%m') = '2021-10'
and start_time is null) as m
 on t.driver_id = m.driver_id
where  t.start_time is not null
group by t.driver_id
order by t.driver_id)
 union all
(select
"总体" driver_id,
round(sum(t.grade)/count(1), 1) avg_grade
from
tb_get_car_order as t right join 
(select driver_id from tb_get_car_order where date_format(order_time,'%Y-%m') = '2021-10'
and  start_time is null) as m
 on t.driver_id = m.driver_id
where t.start_time is not null
group by 1)
全部评论

相关推荐

10-28 14:42
门头沟学院 Java
watermelon1124:因为嵌入式炸了
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务