Members by Age and Reputation

0

Please login or register to vote for this query.

(click on this box to dismiss)

StackOverflow members from youngest to oldest, by reputation over 1000.

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

DECLARE @N TABLE(n INT);
DECLARE @Index INT;
SET @Index = 1;
INSERT INTO @N(n) VALUES (@Index);
WHILE @Index <= 700000 BEGIN 
    SET @Index = @Index*2;
    INSERT INTO @N(n) VALUES (@Index);
END;

DECLARE @AllRep FLOAT;
SET @AllRep=(SELECT SUM(Reputation) FROM Users);
DECLARE @AllUser FLOAT;
SET @AllUser=(SELECT COUNT(*) FROM Users);

SELECT n, Users, Users/@AllUser, Rep, Rep/@AllRep FROM (
    SELECT *,
          (SELECT COUNT(*) FROM Users WHERE Reputation<=n) AS Users,
          (SELECT SUM(Reputation) FROM Users WHERE Reputation<=n) AS Rep
    FROM @N
) AS t;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results