Skip to content

Instantly share code, notes, and snippets.

@mattm
Created Nov 12, 2018
Embed
What would you like to do?
Grouping Styles
# Good: Grouping by column number
...
select
email,
min(expressed_interest_at) as expressed_interest_at
from unioned
group by 1
order by 2
...
# Good: Grouping by column name
...
SELECT a.email, min(b.created_at) AS expressed_interest_at
FROM hubspot.contact AS a
JOIN helpscout.conversation AS b ON a.email = b.email
GROUP BY a.email
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment