Reputation distibution

0

Please login or register to vote for this query.

(click on this box to dismiss)

Reputation distribution among users count.

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 AS MaxRep, Users, Users/@AllUser*100, RepSum, RepSum/@AllRep*100 FROM (
    SELECT *,
          (SELECT COUNT(*) FROM Users WHERE Reputation<=n) AS Users,
          (SELECT SUM(Reputation) FROM Users WHERE Reputation>=n) AS RepSum
    FROM @N
) AS t;

Enter Parameters

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