题解 | #有取消订单记录的司机平均评分#
有取消订单记录的司机平均评分
https://www.nowcoder.com/practice/f022c9ec81044d4bb7e0711ab794531a
with tmp as ( select driver_id from tb_get_car_order where date_format(order_time,'%Y%m')='202110' and start_time is null ) select a.driver_id, round(avg(grade),1) avg_grade from tb_get_car_order a,tmp b where a.driver_id=b.driver_id and grade is not null group by a.driver_id union all select '总体' driver_id, round(avg(grade),1) avg_grade from tb_get_car_order a,tmp b where a.driver_id=b.driver_id and grade is not null order by driver_id