Skip to content

Instantly share code, notes, and snippets.

@Shaddyjr
Created July 17, 2019 05:56
Show Gist options
  • Save Shaddyjr/c16a8555d795f6fe40f1fbaebe69121a to your computer and use it in GitHub Desktop.
Save Shaddyjr/c16a8555d795f6fe40f1fbaebe69121a to your computer and use it in GitHub Desktop.
WITH subq (actor_1_id, actor_2_id, film_id) AS
(SELECT p1.actor_id, p2.actor_id, p2.film_id
FROM film_actor p1
JOIN film_actor p2
ON p1.film_id = p2.film_id
AND p1.actor_id < p2.actor_id
)
SELECT *
FROM subq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment