SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with total_films as ( select count(distinct f.film_id) from film f ) select c.name as category, count(distinct t1.film_id) as cnt from category c join ( select fc.category_id, f.film_id from film_category fc left join film f on fc.film_id = f.film_id ) t1 on c.category_id = t1.category_id group by category

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear