一个很简单的做法

国庆期间近7日日均取消订单量

https://www.nowcoder.com/practice/2b330aa6cc994ec2a988704a078a0703

select distinct date(order_time) dt, 
(select round(sum(if(start_time is null, 0, 1))/7, 2) from tb_get_car_order where timestampdiff(day, date(order_time), date(torder.order_time)) between 0 and 6) finish_num_7d, 
(select round(sum(if(start_time is null, 1, 0))/7, 2) from tb_get_car_order where timestampdiff(day, date(order_time), date(torder.order_time)) between 0 and 6) cancel_num_7d
from tb_get_car_order torder
where date(order_time) between '2021-10-01' and '2021-10-03'
order by 1



全部评论

相关推荐

qazxswedcvfr:开发也是这样想的
点赞 评论 收藏
分享
起名字真难233:这名字一看就比什么上海寻梦信息技术有限公司,北京三快网络技术有限公司等高级不少
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务