From Alex, 4 Months ago, written in Plain Text, viewed 88 times. This paste will give up the ghost in 1 Second.
URL http://codebin.org/view/a4b22215 Embed
Download Paste or View Raw
  1. SELECT cat.name AS name_category,
  2.        count(fc.film_id) AS total_films
  3. FROM category as cat
  4. LEFT OUTER JOIN film_category AS fc ON cat.category_id=fc.category_id
  5. WHERE fc.film_id IN (SELECT fa.film_id
  6.         FROM film_actor as fa
  7.         LEFT OUTER JOIN film_category AS fc ON fa.film_id=fc.film_id
  8.         LEFT OUTER JOIN category AS c ON c.category_id=fc.category_id
  9.         WHERE fa.actor_id IN (SELECT fa.actor_id
  10.                       FROM movie as m
  11.                       RIGHT OUTER JOIN film_actor AS fa ON m.film_id=fa.film_id
  12.                       WHERE m.release_year>2013
  13.                       GROUP BY fa.actor_id
  14.                       HAVING count(m.film_id)>7
  15.                       )
  16.         GROUP BY fa.film_id,fc.category_id)  
  17. GROUP BY cat.name
  18. ORDER BY total_films DESC

Reply to "Untitled"

Here you can reply to the paste above