Skip to content

Instantly share code, notes, and snippets.

@jorvis
Created July 4, 2017 16:36
Show Gist options
  • Save jorvis/c0d43d8ac4f16d77bd180446b43d1fb4 to your computer and use it in GitHub Desktop.
Save jorvis/c0d43d8ac4f16d77bd180446b43d1fb4 to your computer and use it in GitHub Desktop.
Now, how to do with just JOINs?
SELECT f.feature_id
FROM feature f
JOIN cvterm ON f.type_id=cvterm.cvterm_id
WHERE cvterm.name = 'polypeptide'
AND f.feature_id NOT IN (
SELECT f.feature_id
FROM feature f
JOIN cvterm ON f.type_id=cvterm.cvterm_id
JOIN featureprop fp ON f.feature_id=fp.feature_id
JOIN cvterm gpn ON fp.type_id=gpn.cvterm_id
WHERE cvterm.name = 'polypeptide'
AND gpn.name = 'gene_product_name');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment