题解 | #工作日各时段叫车量、等待接单时间和调度时间#

工作日各时段叫车量、等待接单时间和调度时间

https://www.nowcoder.com/practice/34f88f6d6dc549f6bc732eb2128aa338

with t1 as 
(
select order_id,case 
when hour(event_time)>=7 and hour(event_time) <9 then '早高峰'
when hour(event_time)>=9 and hour(event_time)<17 then '工作时间'
when hour(event_time)>=17 and hour(event_time)<20 then '晚高峰'
else '休息时间' #跨天的放在else 
end as period,event_time,end_time
from tb_get_car_record
where weekday(event_time) between 0 and 4
)
select period,count(*) as get_car_num,
round(avg(timestampdiff(second,event_time,end_time)/60),1),
round(avg(timestampdiff(second,order_time,start_time)/60),1)
from t1
inner join tb_get_car_order using(order_id)
group by period
order by get_car_num

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-10 11:55
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-10 14:00
林子大了什么鸟都有啊,我觉得我说的已经很客气了,阴阳谁呢
牛客62656195...:应该不是阴阳吧?你第一次注册的时候boss就说你是牛人
点赞 评论 收藏
分享
屌丝逆袭咸鱼计划:心态摆好,man,晚点找早点找到最后都是为了提升自己好进正职,努力提升自己才是最关键的😤难道说现在找不到找的太晚了就炸了可以鸡鸡了吗😤早实习晚实习不都是为了以后多积累,大四学长有的秋招进的也不妨碍有的春招进,人生就这样
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-08 12:10
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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