Skip to content

Instantly share code, notes, and snippets.

@pnorman
Created April 30, 2014 01:52
Show Gist options
  • Save pnorman/165041d0a63f944a5282 to your computer and use it in GitHub Desktop.
Save pnorman/165041d0a63f944a5282 to your computer and use it in GitHub Desktop.
SQL to find active contributors as of 20140401
SELECT COUNT(*)
FROM (
SELECT user_name, COUNT(*) AS months
FROM (
SELECT DISTINCT user_name, date_trunc('month', created_at) as mon
FROM osm_changeset
WHERE num_changes > 0
AND created_at BETWEEN '20130401'::date AND '20140401'::date)
AS um GROUP BY user_name)
AS mon
WHERE months >= 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment