Top 200 Users, augmented with Votes/Day (VoteType = UpVotes or DownVotes)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

set nocount on

DECLARE @endDate date
SELECT @endDate = max(CreationDate) from Posts

set nocount off
;

WITH TOP200 AS (
  SELECT TOP 200
     *, CONVERT(int, @endDate - CreationDate) as Days
  FROM
     Users
  ORDER BY
     Reputation DESC
), TOP200Augmented AS (
  SELECT
    Id AS [User Link],
    Reputation,
    Days,
    ##VoteType##,
    CONVERT(float, ##VoteType##)/Days as VotesPerDay
  FROM TOP200
)

SELECT *
FROM TOP200Augmented
ORDER BY VotesPerDay

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached