urgent edits

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

SELECT TOP 10
       COUNT(DISTINCT ph.PostId) AS 'Posts edits', -- every post counts once only
       COUNT(DISTINCT CASE WHEN p.PostTypeId = 1 THEN ph.PostId ELSE NULL END) AS 'Question edits',
       COUNT(DISTINCT ph.RevisionGUID) AS 'Revisions edits', -- every revision counts once only
       SUM(CASE WHEN ph.PostHistoryTypeId = 4 THEN 1 ELSE 0 END) AS 'Titles edits',
       SUM(CASE WHEN ph.PostHistoryTypeId = 5 THEN 1 ELSE 0 END) AS 'Bodies edits',
       ph.UserId AS [User Link]
FROM   PostHistory ph
JOIN   Posts p ON p.Id = ph.PostId AND p.OwnerUserId <> ph.UserId
WHERE ph.Comment like '%urgent%'
GROUP BY ph.UserId
ORDER BY 'Posts edits' DESC

Enter Parameters

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