Skip to content

Instantly share code, notes, and snippets.

@doryokujin
Created April 23, 2015 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doryokujin/cc2d87d3289cdc532142 to your computer and use it in GitHub Desktop.
Save doryokujin/cc2d87d3289cdc532142 to your computer and use it in GitHub Desktop.
SELECT n1.id, n2.id, n1.id || ' ♥ ' || n2.id
FROM
(
SELECT id, gender
FROM men_and_women
) n1,
(
SELECT id, gender
FROM men_and_women
) n2
WHERE n1.id < n2.id
ORDER BY n1.id, n2.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment