Duplicates list editted

1

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 tmp.PostId , tmp.originQ , tmp.currentQ
FROM
(
SELECT pl.PostId AS 'PostId',
  JSON_VALUE(ph.Text, '$.OriginalQuestionIds[1]') AS 'originQ',
  pl.RelatedPostId AS 'currentQ', pl.CreationDate AS 'CreationDate'
  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
) as tmp
WHERE tmp.originQ != tmp.currentQ
ORDER BY tmp.CreationDate DESC

Enter Parameters

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