User Edit Count

0

Please login or register to vote for this query.

(click on this box to dismiss)

Counts the number of edits a user has made to posts

Stack Overflow

Q&A for professional and enthusiast programmers

-- User Edit Count
-- Counts the number of edits a user has made to posts

DECLARE @UserId int = ##UserId##

SELECT COUNT(*) FROM
(
    SELECT DISTINCT Id FROM Posts
    WHERE Id IN
    (
        SELECT PostId FROM PostHistory
        WHERE PostHistoryTypeId IN
        (
            SELECT Id FROM PostHistoryTypes
            WHERE Name = 'Edit Title'
            OR Name = 'Edit Body'
        )
        AND UserId = @UserId
    )
    AND OwnerUserId <> @UserId
    AND CommunityOwnedDate IS NULL
) AS PostsWithEdits

Enter Parameters

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