Skip to content

Instantly share code, notes, and snippets.

@alexleventer
Last active April 22, 2016 16:40
Show Gist options
  • Save alexleventer/5d64ee0c55c3cc64c839d898b10ee68f to your computer and use it in GitHub Desktop.
Save alexleventer/5d64ee0c55c3cc64c839d898b10ee68f to your computer and use it in GitHub Desktop.
Favorite Queries
SELECT applications.domain, users.email, users.time as SignupDate, count(*) AS Apps,
(SELECT COUNT(*) FROM tasks where tasks.domain = applications.domain) as Builds,
(SELECT COUNT(*) FROM deployments WHERE deployments.domain = applications.domain) as Deploys,
(SELECT COUNT(*) FROM oauth WHERE oauth.domain = applications.domain) as SourceControl
FROM applications
JOIN users ON applications.domain = users.domain
WHERE users.time > UNIX_TIMESTAMP(CURRENT_TIMESTAMP - INTERVAL 1 WEEK) * 1000
GROUP BY applications.domain;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment