Q&A for scientists using computers to solve scientific problems
; with revisions_cte AS ( SELECT p.Id AS pid, MIN(ph1.Id) AS phId FROM PostHistory ph1 INNER JOIN Posts p ON ph1.PostId=p.Id WHERE ph1.PostHistoryTypeId in (3,6,9) and ph1.Text Like '%<##tag1?status-review##>%' GROUP BY p.Id ) SELECT TOP(##num?500##) ph.PostId AS [Post Link], url = 'site://posts/' + CAST(ph.PostId AS varchar)+'/revisions', p.CreationDate, ph.CreationDate, ph.UserId AS [User Link], DATEDIFF(day, p.CreationDate, ph.CreationDate) AS Days, DATEDIFF(hour, p.CreationDate, ph.CreationDate) AS Hours, DATEDIFF(minute, p.CreationDate, ph.CreationDate) AS Minutes FROM PostHistory ph INNER JOIN revisions_cte ON ph.Id=phId INNER JOIN Posts p ON ph.PostId=p.Id WHERE p.OwnerUserId=##userid## ORDER BY DATEDIFF(minute, p.CreationDate, ph.CreationDate)