一个很简单的做法
国庆期间近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