Created
December 16, 2014 23:08
-
-
Save jmcguirk/bdcb9a83b20b20d2db13 to your computer and use it in GitHub Desktop.
7D ARPU by country/device
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 install.os, | |
install.country, | |
Count(DISTINCT install.device_tag) AS installs, | |
Count(DISTINCT economy.device_tag) AS spenders, | |
Sum(economy.spend_amount) AS total_spent | |
FROM install | |
LEFT OUTER JOIN economy | |
ON ( install.device_tag = economy.device_tag | |
AND economy.spend_type = 'cash_purchase' | |
AND Datediff('day', economy.ingest_datetime, | |
install.ingest_datetime) <= 7 ) | |
WHERE install.device_tag != 'missing' | |
AND install.ingest_datetime < '2014-12-08' | |
AND install.ingest_datetime >= '2014-12-07' | |
GROUP BY 1, | |
2 | |
ORDER BY 1 DESC, | |
2 DESC | |
LIMIT 1000; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment