Longest time before the tag was added


Please login or register to vote for this query.

(click on this box to dismiss)

Ask Different

Q&A for power users of Apple hardware and software

with firstrev_cte AS
SELECT MIN(ph.Id) AS MinId, p.Id
FROM Posts p JOIN PostHistory ph ON ph.PostId=p.Id
WHERE ph.Text LIKE '%<##tagName?featured##>%'
  AND ph.PostHistoryTypeId in (3,6,9)

SELECT TOP(##num?100##)
  ph.PostId AS [Post Link],
  url = 'site://posts/' + CAST(ph.PostId AS varchar)+'/revisions',
  ph.UserId AS [User Link], ph.UserDisplayName,
  ph.CreationDate AS [Featured Date],
  p.CreationDate, p.LastActivityDate,
  DATEDIFF(Day, p.CreationDate, ph.CreationDate) AS [Days until tag]
FROM PostHistory ph INNER JOIN firstrev_cte ON ph.Id=MinId
  INNER JOIN Posts p ON ph.PostId=p.Id
ORDER BY  DATEDIFF(Day, p.CreationDate, ph.CreationDate) DESC

Enter Parameters

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