题解 | 2021年国庆在北京接单3次及以上的司机统计信息

select distinct r.city, round(avg(count(order_time)) over(),3) avg_order_num, round(avg(sum(fare)) over(),3) avg_income
from tb_get_car_order o
join tb_get_car_record r
on o.order_id = r.order_id
where r.city='北京' 
and  o.order_time between '2021-10-01' and '2021-10-07'
group by r.city, o.driver_id
having count(o.order_time)>=3

注意:

①distinct city

②窗口函数直接计算平均值

全部评论

相关推荐

你背过凌晨4点的八股文么:简历挂了的话会是流程终止,像我一样
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务