edits 4 badges - Matthew version

0

Please login or register to vote for this query.

(click on this box to dismiss)

SharePoint

Q&A for SharePoint enthusiasts

DECLARE @userid int = ##user##

SELECT COUNT(*) AS Edits4Badges
FROM (
    SELECT CAST(CreationDate AS SMALLDATETIME) AS foo, PostID
    FROM PostHistory ph
    WHERE PostHistoryTypeId IN (4,5)
        AND PostId NOT IN (
            SELECT p.Id
            FROM Posts p
            WHERE p.OwnerUserId = ph.UserId
        )
        AND UserID = @userid
    GROUP BY CAST(CreationDate AS SMALLDATETIME), PostID
) AS bar

Enter Parameters

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