-
-
Save mattm/567e35d9d5b301040f0800dae585f057 to your computer and use it in GitHub Desktop.
SQL Screener Answer
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
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