Duplicate posts and their originals

0

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy Meta

Q&A about the site for science fiction and fantasy enthusiasts

SELECT p.Title, pd.NumberOfChildren, p.Tags FROM Posts p
INNER JOIN
  (SELECT COUNT(pd.Id) AS NumberOfChildren, JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]') AS OriginalPostId
  FROM posts pd
  INNER JOIN PostHistory ph on ph.postid = pd.id
  WHERE pd.posttypeid = 1 -- q
  AND ph.PostHistoryTypeId = 10 -- closed
  AND ph.comment = 101 -- as duplicate
  AND pd.CreationDate > '2021-04-01'
  GROUP BY JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]')
  HAVING COUNT(pd.Id) > 1) pd
ON pd.OriginalPostId = p.Id

Enter Parameters

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