Skip to content

Instantly share code, notes, and snippets.

@meau
Last active November 12, 2018 17: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 meau/5ebfea615a18858ad08448095e08326f to your computer and use it in GitHub Desktop.
Save meau/5ebfea615a18858ad08448095e08326f to your computer and use it in GitHub Desktop.
SELECT
*
FROM
(SELECT
accession.id
FROM
accession) AS A
LEFT JOIN
(SELECT DISTINCT
accession.id
FROM
accession
JOIN linked_agents_rlshp ON linked_agents_rlshp.accession_id = accession.id
JOIN enumeration_value evrole ON linked_agents_rlshp.role_id = evrole.id
WHERE
evrole.value = 'source') AS B ON A.id = B.id
WHERE
B.id IS NULL
ORDER BY A.id DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment