Skip to content

Instantly share code, notes, and snippets.

@Yenwod
Last active February 25, 2018 23:28
Show Gist options
  • Save Yenwod/09853eb4bd5e6ffca8a9fb2405888340 to your computer and use it in GitHub Desktop.
Save Yenwod/09853eb4bd5e6ffca8a9fb2405888340 to your computer and use it in GitHub Desktop.
-- how many new users signed in past 24 hours?
--select id, email, name, sign_in_count, last_sign_in_at, created_at
select count(*)
from users
where NOW() > last_sign_in_at
AND NOW() - last_sign_in_at <= interval '24 hours'
and sign_in_count = 1;
-- how many return users?
--select id, email, name, sign_in_count, last_sign_in_at, created_at
select count(*)
from users
where NOW() > last_sign_in_at
AND NOW() - last_sign_in_at <= interval '24 hours'
and sign_in_count > 1;
-- how many lot searches?
select count(*)
from lot_search_logs
where NOW() > created_at
AND NOW() - created_at <= interval '24 hours'
-- any unconfirmed registrations?
--select id, email, name, sign_in_count, last_sign_in_at, created_at, confirmed_at
select count(*)
from users
where NOW() > last_sign_in_at
AND NOW() - last_sign_in_at <= interval '24 hours'
and confirmed_at is null ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment