Skip to content

Instantly share code, notes, and snippets.

@brianbancroft
Created October 27, 2017 12:51
Show Gist options
  • Save brianbancroft/2093563fee73f40efd2068b283f479c5 to your computer and use it in GitHub Desktop.
Save brianbancroft/2093563fee73f40efd2068b283f479c5 to your computer and use it in GitHub Desktop.
Get me some registrations
SELECT(
SELECT COUNT(*)
FROM regs
WHERE invite_sent_at <= NOW() - INTERVAL '10 days'
) AS count_users,
(
SELECT COUNT(*)
FROM regs
WHERE invite_sent_at <= NOW() - INTERVAL '30 days'
) AS count_users,
(
SELECT COUNT(*)
FROM regs
WHERE invite_sent_at <= NOW() - INTERVAL '60 days'
) AS count_users,
(
SELECT COUNT(*)
FROM regs
WHERE invite_sent_at <= NOW() - INTERVAL '90 days'
) AS count_users,
(
SELECT COUNT(*)
FROM regs
WHERE invite_sent_at <= NOW() - INTERVAL '120 days'
) AS count_users,
(
SELECT COUNT(*)
FROM regs
WHERE invite_sent_at <= NOW() - INTERVAL '150 days'
) AS count_users
FROM regs
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment