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 COUNT(*) FROM Posts p
WHERE p.CreationDate < DATEADD(month, -6, p.LastActivityDate)
and P.LastEditorUserId = @UserId
and P.OwnerUserId != @UserId