Top 100 Most Prolific Editors and YOU

1

Please login or register to vote for this query.

(click on this box to dismiss)

Shows the top 100 post editors, where the user was the most recent editor and the post was not his own. And *YOU* in comparison.

Stack Overflow

Q&A for professional and enthusiast programmers

-- Top 100 Most Prolific Editors and YOU
-- Results are conservative compared to the total number of edits.
-- With optimized query performance compared to previous version:
-- "Top 50 Most Prolific Editors"

DECLARE @UserId int = ##UserId:int?939860##;      -- Erwin as default

SELECT CASE WHEN [User Link] = @UserId THEN 'YOU'
       ELSE CAST(rank() OVER (ORDER BY TotalEdits DESC) AS varchar) END AS rank
      , *
FROM (
  (
  SELECT TOP 100
         LastEditorUserId AS [User Link]
        ,COUNT(*) AS TotalEdits
        ,COUNT(CASE WHEN PostTypeId = 1 THEN 1 ELSE NULL END) AS QuestionEdits
        ,COUNT(CASE WHEN PostTypeId = 2 THEN 1 ELSE NULL END) AS AnswerEdits
  FROM   Posts
  WHERE  LastEditorUserId <> OwnerUserId
  GROUP  BY LastEditorUserId
  ORDER  BY TotalEdits DESC
  )
  
  UNION
  SELECT @UserId
        ,COUNT(*) AS TotalEdits
        ,COUNT(CASE WHEN PostTypeId = 1 THEN 1 ELSE NULL END) AS QuestionEdits
        ,COUNT(CASE WHEN PostTypeId = 2 THEN 1 ELSE NULL END) AS AnswerEdits
  FROM   Posts
  WHERE  OwnerUserId <> @UserId
  AND    LastEditorUserId = @UserId
  ) AS x

Enter Parameters

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