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
with v1 as (select category_id , film_id , count(rental_id) as co , rank() over(partition by category_id order by count(rental_id) desc) as ra from film_category join inventory using(film_id) join rental using(inventory_id) where year(rental_date) = 2005 group by category_id, film_id) select category_id , group_concat(film_id) from v1 where ra = 1 group by category_id

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

Copy Clear