Skip to content

Instantly share code, notes, and snippets.

@jaymay
Created March 2, 2015 21:17
Show Gist options
  • Save jaymay/60762f125e4359abe104 to your computer and use it in GitHub Desktop.
Save jaymay/60762f125e4359abe104 to your computer and use it in GitHub Desktop.
Enterprise account info from PDW
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