Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
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)

Stuck with a problem? Got Error? Ask AI support!

Copy Clear