User Edit Count Rank

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

WITH RankedUsers AS (
  SELECT RANK() OVER (ORDER BY COUNT(DISTINCT ph.PostId) DESC) AS Rank,
         ph.UserId,
         COUNT(DISTINCT ph.PostId) AS EditCount  -- only count each post once
  FROM PostHistory ph
  JOIN Posts p ON ph.PostId = p.Id
              AND ph.UserId != p.OwnerUserId     -- only other people's posts
  WHERE PostHistoryTypeId IN (4,5)               -- only edits to title or body
  GROUP BY ph.UserId
)
SELECT Rank,
       UserID AS [User Link],
       EditCount
FROM RankedUsers
WHERE Rank < 100
   OR UserID = ##UserId##
ORDER BY Rank

Enter Parameters

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