Skip to content

Instantly share code, notes, and snippets.

@mikechau
Created March 28, 2016 19:04
Show Gist options
  • Save mikechau/a4ca1d36cbff011fbc7b to your computer and use it in GitHub Desktop.
Save mikechau/a4ca1d36cbff011fbc7b to your computer and use it in GitHub Desktop.
sql query for finding an association
SELECT column FROM table1 WHERE EXISTS (SELECT column2 FROM table2 WHERE table1.column1 = table2.column2.id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment