What is my Archaeologist badge progress? - With the CORRECT UserId

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

-- How close are you to getting the Archaeologist badge?
--  "Edited 100 posts that were inactive for 6 months"
-- This is a rough estimate as the LastEditDate and LastActivityDate 
-- changes as soon as you edit the post

DECLARE @UserId INT = ##UserId##;

--select top 10 * from PostHistoryTypes
--@UserId,
--p.LastActivityDate, DATEADD(month, -6, p.LastEditDate)
--from posts p
--WHERE
--p.LastActivityDate = p.LastEditDate
--P.LastEditorUserId = @UserId
--SELECT COUNT(*) FROM Posts p
--WHERE p.LastActivityDate < DATEADD(month, -6, p.LastEditDate)
--and P.LastEditorUserId = @UserId
--and P.OwnerUserId != @UserId
SELECT TOP 100
*
FROM [PostHistory] [ph] (NOLOCK)
WHERE
([ph].[PostHistoryTypeId] > 3 AND [ph].[PostHistoryTypeId] < 7)
ORDER BY 
[ph].[PostId] ASC, [ph].[CreationDate] DESC

Enter Parameters

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