题解 | #有取消订单记录的司机平均评分#
有取消订单记录的司机平均评分
https://www.nowcoder.com/practice/f022c9ec81044d4bb7e0711ab794531a
select if(driver_id is null, "总体",driver_id), round(avg(grade),1) from tb_get_car_order where start_time is not null and driver_id in (select driver_id from tb_get_car_order where start_time is null and finish_time >= '2021-10-01' and finish_time < '2021-11-01') group by driver_id with rollup;
step 1 筛选出10月有取消订单记录的司机名单
step 2 得出在名单中的司机的评分
step 3 使用with rollup 进行汇总
#sql#
