Created
July 14, 2015 22:54
-
-
Save jaymay/ea1f40b417122223fc7f to your computer and use it in GitHub Desktop.
Mongo collections example
This file contains hidden or 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
select case when u.roles in (2,3) then 'agent' | |
else 'user' | |
end role, | |
asr.target_audience, | |
count(*) num_views, | |
count(distinct unique_token) unique_tokens | |
from default.stats_hc_events hc | |
left outer join classic.users u on u.id = hc.user_id | |
inner join classic.account_survey_responses asr on asr.account_id = hc.account_id | |
where dt between 20150601 and 20150607 and hc.child_type = 'Article' and hc.type = 'child_view' | |
group by case when u.roles in (2,3) then 'agent' | |
else 'user' | |
end, | |
asr.target_audience |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment