题解 | #国庆期间近7日日均取消订单量#

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

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

with a1 as(
select distinct date(order_time) dt
from tb_get_car_order
where date(order_time) between '2021-10-01' and '2021-10-03'
)
select a.dt,round(count(start_time)/7,2) finish_num_7d
,round((count(dt)-count(start_time))/7,2) cancel_num_7d
from a1 a
left join tb_get_car_order b
on datediff(a.dt,date(b.order_time)) between 0 and 6 
group by a.dt
order by a.dt;

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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