Skip to content

Instantly share code, notes, and snippets.

@mattm
Last active November 12, 2018 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattm/567e35d9d5b301040f0800dae585f057 to your computer and use it in GitHub Desktop.
Save mattm/567e35d9d5b301040f0800dae585f057 to your computer and use it in GitHub Desktop.
SQL Screener Answer
with hubspot_interest as (
select
email,
timestamp_millis(property_beacon_interest) as expressed_interest_at
from hubspot.contact
where property_beacon_interest is not null
),
support_interest as (
select
email,
created_at as expressed_interest_at
from helpscout.conversation
join helpscout.conversation_tag on conversation.id = conversation_tag.conversation_id
where tag = "beacon-interest"
),
combined_interest as (
select * from hubspot_interest
union all
select * from support_interest
),
final as (
select
email,
min(expressed_interest_at) as expressed_interest_at
from combined_interest
group by 1
)
select * from final
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment