Created
April 19, 2012 14:23
-
-
Save ThomasLocke/2421273 to your computer and use it in GitHub Desktop.
SQL Query with a bunch of JOIN's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT "Organization".*, | |
"ContactEntity".ce_id, | |
"ContactEntity".ce_name, | |
"ContactEntity".isperson, | |
"Tag".tag_id, | |
"Tag".tag_name | |
FROM "Organization" | |
LEFT JOIN "ContactEntity_Organization" | |
ON "Organization".org_id = "ContactEntity_Organization".org_id | |
LEFT JOIN "ContactEntity" | |
ON "ContactEntity".ce_id = "ContactEntity_Organization".ce_id | |
LEFT JOIN "ContactEntity_Tag" | |
ON "ContactEntity".ce_id = "ContactEntity_Tag".ce_id | |
LEFT JOIN "Tag" | |
ON "Tag".tag_id = "ContactEntity_Tag".tag_id | |
WHERE "Organization".org_id = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment