select week(r.rental_date) as week_num, count(*) as weekly_average_rental_count
from rental r
join customer c
on r.customer_id=c.customer_id
where year(r.rental_date)=2005 and month(r.rental_date)=08 and
r.rental_date between date_add(r.rental_date, interval -1 week) and date_add(r.rental_date, interval 1 week)
group by c.customer_id
having count(*)=(select avg(count(*)) from rental group by customer_id)