select dt, round(a/7,2), round(b/7,2) from( select distinct date(order_time) dt, count(fare)over(order by date(order_time) range interval 6 day preceding) a, count(if(fare is null, 1, null))over(order by date(order_time) range interval 6 day preceding) b from tb_get_car_order) as tb1 where dt between '2021-10-01' and '2021-10-03' order by dt