Q&A for professional and enthusiast programmers
SELECT pl.PostId AS [Post Link], JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]') AS 'Original duplicate', pl.RelatedPostId AS [Post Link] --SELECT JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]') AS [Post Link], -- pl.RelatedPostId AS [Post Link] FROM PostHistory AS ph INNER JOIN PostLinks AS pl ON pl.PostId = ph.PostId AND pl.LinkTypeId = 3 -- duplicate WHERE ph.PostHistoryTypeId = 10 -- question closed AND ph.Comment = 101 -- as a duplicate