Skip to content

Instantly share code, notes, and snippets.

@mattm

mattm/join.sql Secret

Created Nov 12, 2018
Embed
What would you like to do?
INNER vs LEFT JOIN
# Good: INNER JOIN
...
SELECT a.email AS email, a.created_at AS expressed_interest_at
FROM helpscout.conversation AS a
INNER JOIN helpscout.conversation AS b ON a.id = b.conversation_id
WHERE b.conversation_id = 'beacon-interest'
...
# Okay: LEFT JOIN
...
select
c.email,
c.created_at as expressed_interest_at
from hubspot.conversation c
left join hubspot.conversation_tag t on c.id = t.conversation_id
where t.tag = 'beacon-interest'
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment