DECLARE @userid int = ##UserId## SELECT PostID As [Po...


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Copy Editor Progress
-- This query returns the number of edits you still need to
-- get the Copy Editor badge.

DECLARE @userid int = ##UserId##

    SELECT   PostID As [Post Link], PostHistoryTypeId, p.CreationDate, ph.CreationDate
    FROM     PostHistory ph
      JOIN   Posts p ON ph.PostId=p.Id
    WHERE    PostHistoryTypeId IN (4,5)
        AND ph.UserID = @userid
        AND p.OwnerUserId != ph.UserId
        AND abs(datediff(year, ph.CreationDate, p.CreationDate)*365.25) + abs(datediff(dayofyear, ph.CreationDate, p.CreationDate)) > (6 * 30+3)
    ORDER BY ph.CreationDate DESC

Enter Parameters

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