Q&A about the site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation
SELECT ph.PostId AS [Post Link], revisions = 'site://posts/' + CAST(ph.PostId AS varchar)+'/revisions' FROM PostHistory ph INNER JOIN Posts p ON p.Id=ph.PostId WHERE (ph.PostHistoryTypeId=16) ---16 = CW AND (ph.UserId!=p.OwnerUserId) ---turned to CW by a user other than the OP AND ph.Id IN ( SELECT MAX(Id) as last FROM PostHistory GROUP BY PostId ) ---only look at the last event for the given post ORDER BY ph.PostId DESC