题解 | #各城市最大同时等车人数#

各城市最大同时等车人数

https://www.nowcoder.com/practice/f301eccab83c42ab8dab80f28a1eef98

with t1 as
(
    select city,event_time as tm,1 as outin
    from tb_get_car_record
    union all
    select city,case 
    when order_id is null then end_time #用户取消订单/没司机接单
    when start_time is null then finish_time #用户或取消订单
    else start_time end as ft,-1
    from tb_get_car_record
    left join tb_get_car_order using(order_id)#可能出现无订单号的情况
)
select city,max(pku)
from
(
select city,tm,sum(outin) over(order by tm asc,outin desc) as pku #先计算用户增加
from t1
where substr(tm,1,7)='2021-10'
)t
group by city,date(tm) #城市单日订单峰值

全部评论

相关推荐

12-18 19:36
已编辑
门头沟学院 Java
程序员牛肉:可以的,简历没毛病了。 虽然还是偏向同质化,不过学历不错。后续我觉得重心放到刷实习+摆脱同质化问题上
实习简历求拷打
点赞 评论 收藏
分享
程序员牛肉:你这简历有啥值得拷打的?在牛客你这种简历一抓一大把,也就是个人信息不一样而已。 关键要去找亮点,亮点啊,整个简历都跟流水线生产出来的一样。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务