User's creation date by reputation, per month since 2011

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
     Year(Users.CreationDate) as Year,
     Month(Users.CreationDate) as Month,
     SUM(Case when Users.Reputation <= 100 AND Users.Reputation > 0 then 1 else 0 end) As "0 - 100",
     SUM(Case when Users.Reputation <= 160 AND Users.Reputation > 100 then 1 else 0 end) As "100 - 160",
     SUM(Case when Users.Reputation <= 250 AND Users.Reputation > 160 then 1 else 0 end) As "160 - 250",
     SUM(Case when Users.Reputation <= 350 AND Users.Reputation > 250 then 1 else 0 end) As "250 - 350",
     SUM(Case when Users.Reputation <= 500 AND Users.Reputation > 350 then 1 else 0 end) As "350 - 500",
     SUM(Case when Users.Reputation <= 700 AND Users.Reputation > 500 then 1 else 0 end) As "500 - 700",
     SUM(Case when Users.Reputation <= 1000 AND Users.Reputation > 700 then 1 else 0 end) As "700 - 1000",
     SUM(Case when Users.Reputation <= 1400 AND Users.Reputation > 1000 then 1 else 0 end) As "1000 - 1400",
     SUM(Case when Users.Reputation <= 2000 AND Users.Reputation > 1400 then 1 else 0 end) As "1400 - 2000",
     SUM(Case when Users.Reputation <= 3000 AND Users.Reputation > 2000 then 1 else 0 end) As "2000 - 3000",
     SUM(Case when Users.Reputation <= 5000 AND Users.Reputation > 3000 then 1 else 0 end) As "3000 - 5000",
     SUM(Case when Users.Reputation <= 10000 AND Users.Reputation > 5000 then 1 else 0 end) As "5000 - 10000",
     SUM(Case when Users.Reputation <= 20000 AND Users.Reputation > 10000 then 1 else 0 end) As "10000 - 20000",
     SUM(Case when Users.Reputation <= 50000 AND Users.Reputation > 20000 then 1 else 0 end) As "20000 - 50000",
     SUM(Case when Users.Reputation > 50000 then 1 else 0 end) As "> 50000",
     COUNT(*) AS 'All users'
FROM  Users
WHERE Year(Users.CreationDate) > 2010
GROUP BY Year(Users.CreationDate), Month(Users.CreationDate)
ORDER BY Year, Month

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results