-
-
Save mattm/075b6b5c5823cb390b19bf29dcb32b07 to your computer and use it in GitHub Desktop.
WHERE clause vs JOIN condition
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
# Good: Filtering in the WHERE clause | |
... | |
SELECT cnv.email, | |
cnv.created_at AS expressed_interest_at | |
FROM helpscout.conversation AS cnv | |
JOIN helpscout.conversation_tag AS ctg | |
ON cnv.id = ctg.conversation_id | |
WHERE ctg.tag = 'beacon-interest' | |
... | |
# Good: Including it in the join condition | |
... | |
select conv.email, conv.created_at as expressed_interest_at | |
from helpscout.conversation conv | |
join helpscout.conversation_tag tag | |
on conv.id = tag.conversation_id and tag.tag = 'beacon-interest' | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment