Skip to content

Instantly share code, notes, and snippets.

@masolino
Created June 26, 2014 13:02
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 masolino/753175dfd56908f969ab to your computer and use it in GitHub Desktop.
Save masolino/753175dfd56908f969ab to your computer and use it in GitHub Desktop.
SELECT * FROM (
(SELECT people.id AS person_id, people.email AS person_email, people.name AS person_name, results.title AS result_title, results.id AS result_id
FROM people, contents AS results, downloads
WHERE results.id = 166674
AND downloads.content_id = results.competition_id
AND downloads.person_id = people.id)
UNION
(SELECT people.id AS person_id, people.email AS person_email, people.name AS person_name, results.title AS result_title, results.id AS result_id
FROM people, contents AS results, resource_visits
WHERE results.id = 166674
AND resource_visits.competition_id = results.competition_id
AND resource_visits.person_id = people.id)
) AS email
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment