Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT c.name AS name_category,
- COUNT(mov.film_id) AS total_films
- FROM category AS c
- LEFT JOIN film_category AS fc ON c.category_id=fc.category_id
- LEFT JOIN
- (SELECT DISTINCT m.film_id
- FROM movie AS m
- LEFT JOIN film_category AS fc ON m.film_id=fc.film_id
- LEFT JOIN film_actor AS fa ON fc.film_id=fa.film_id
- WHERE fa.actor_id IN (SELECT a1.actor_id
- FROM actor AS a1
- LEFT JOIN film_actor AS fa1 ON a1.actor_id=fa1.actor_id
- LEFT JOIN movie AS m1 ON fa1.film_id=m1.film_id
- WHERE m1.release_year > 2013
- GROUP BY a1.actor_id
- HAVING a1.actor_id > 7)) AS mov ON fc.film_id=mov.film_id
- GROUP BY name_category
- ORDER BY total_films DESC
Add Comment
Please, Sign In to add comment