题解 | #国庆期间近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;