Duplicate posts and their originals

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mythology

Q&A for enthusiasts and scholars of mythology and folklore

SELECT top 2000 p.Id, p.Title, pd.NumberOfChildren, p.Tags, pd.ChildTitles FROM Posts p
INNER JOIN
  (SELECT COUNT(pd.Id) AS NumberOfChildren, 
  JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]') AS OriginalPostId,
  STRING_AGG(pd.Title, '||') AS ChildTitles
  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 > '2010-01-01'
  GROUP BY JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]')
  HAVING COUNT(pd.Id) > 1) pd
ON pd.OriginalPostId = p.Id
WHERE 
  (p.Tags LIKE '%<dnd-5e>%')

Enter Parameters

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