SELECT TOP 10 'https://stackoverflow.com/q/' + CAST(p.Id ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT TOP 10
  'https://stackoverflow.com/q/' + CAST(p.Id AS nvarchar) AS [Post],
  'https://stackoverflow.com/q/' + CAST(JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]') AS nvarchar) AS [Dupe]
FROM PostHistory ph
  JOIN Posts p ON p.Id = ph.PostId
WHERE 
  p.PostTypeId = 1 -- Question
  AND ph.PostHistoryTypeId = 10 -- Close event
  AND ph.Comment = 101 -- Dupe

Enter Parameters

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