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

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

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

1.筛选出有过退单记录的司机

select driver_id
from tb_get_car_order
where 
start_time is null

2.统计分数平均,保留一位小数

round(avg(grade),1)

3.汇总列

ifnull(driver_id,'总体')
with rollup

最终的sql

select ifnull(driver_id,'总体'), round(avg(grade),1)
from tb_get_car_order
where driver_id in
(select driver_id
from tb_get_car_order
where 
start_time is null)
group by driver_id
with rollup
全部评论
该牛油正在参与牛客写题解薅羊毛的活动,牛币,周边,京东卡超多奖品放送,活动进入倒计时!快来捡漏啦https://www.nowcoder.com/discuss/888949?source_id=profile_create_nctrack&channel=-1
点赞 回复 分享
发布于 2022-04-27 12:14

相关推荐

缒梦&独舞:这家公司是这样的,去年给我实习offer了,不过也是面着玩儿的,他周六还要去做公益志愿活动
点赞 评论 收藏
分享
评论
2
2
分享

创作者周榜

更多
牛客网
牛客企业服务