Your post edits by OP

1

Please login or register to vote for this query.

(click on this box to dismiss)

Emacs

Q&A for those using, extending or developing Emacs

DECLARE @UserId INT = (
  SELECT Id FROM Users WHERE AccountId = ##SEAccountId:int##
);

WITH Raw AS (
  SELECT PostHistory.RevisionGUID, MIN(Posts.OwnerUserId) AS UserId
  FROM PostHistory, Posts
  WHERE
    PostHistory.PostId = Posts.Id
    AND
    PostHistory.PostHistoryTypeId <= 9
    AND
    PostHistory.UserId = @UserId
    AND
    Posts.OwnerUserId > 0
    AND
    Posts.OwnerUserId <> PostHistory.UserId
  GROUP BY PostHistory.RevisionGUID
)
SELECT UserId AS [User Link], COUNT(DISTINCT RevisionGUID) AS EditCount
FROM Raw
GROUP BY UserId
ORDER BY EditCount DESC, UserId DESC

Enter Parameters

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