Created
March 2, 2015 21:17
-
-
Save jaymay/60762f125e4359abe104 to your computer and use it in GitHub Desktop.
Enterprise account info from PDW
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
use dw_prod_analytics; | |
SELECT | |
a.account_id, | |
a.subdomain, | |
co.num_tickets, | |
co.num_users, | |
r.num_agents + r.num_admins activated_agents, | |
a.max_agents | |
FROM | |
accounts a | |
INNER JOIN | |
count_objects co USING (account_id , run_at , timespan) | |
INNER JOIN | |
roles r USING (account_id , run_at , timespan) | |
INNER JOIN | |
zuora_mrr mrr USING (account_id , run_at , timespan) | |
WHERE | |
run_at = (SELECT | |
MAX(run_at) | |
FROM | |
accounts) | |
AND a.plan_type = 4 | |
AND a.account_type = 'customer' | |
AND mrr.mrr > 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment