Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save carols10cents/48e495198f329e52f74978c59b094581 to your computer and use it in GitHub Desktop.
Save carols10cents/48e495198f329e52f74978c59b094581 to your computer and use it in GitHub Desktop.
select count(distinct crate_owners.owner_id)
from crates
join crate_owners
on crates.id = crate_owners.crate_id
where date(crates.created_at) >= '2016-05-15'
and crate_owners.owner_id NOT IN (
select distinct crate_owners.owner_id
from crates
join crate_owners
on crates.id = crate_owners.crate_id
where date(crates.created_at) < '2016-05-15'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment