Duplicate posts and their originals


Please login or register to vote for this query.

(click on this box to dismiss)

Stellar Meta

Q&A about the site for developers and users of Stellar and the Stellar Distributed Exchange

SELECT p.Title, pd.NumberOfChildren, p.Tags FROM Posts p
  (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

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