Last active
April 2, 2024 10:00
-
-
Save lfy79001/c441969ae2630ca7edccec0a1249cc72 to your computer and use it in GitHub Desktop.
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 filtered_uniques AS ( | |
SELECT | |
user_id, | |
COUNT(event.placement_id) AS frequency | |
FROM adh.cm_dt_impressions | |
WHERE user_id != '0' | |
AND event.advertiser_id IN UNNEST(@advertiser_ids) | |
AND event.campaign_id IN UNNEST(@campaign_ids) | |
AND event.country_domain_name = 'US' | |
GROUP BY user_id | |
) | |
SELECT | |
frequency, | |
COUNT(*) AS uniques | |
FROM filtered_uniques | |
GROUP BY frequency | |
ORDER BY frequency | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment