Duplicate posts and their originals

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

SELECT top 20 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 > '2021-04-01'
  GROUP BY JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]')
  HAVING COUNT(pd.Id) > 1) pd
ON pd.OriginalPostId = p.Id
WHERE 
  (p.Tags LIKE '%<javascript>%'
  OR p.Tags LIKE '%<python>%'
  OR p.Tags LIKE '%<java>%'
  OR p.Tags LIKE '%<c#>%'
  OR p.Tags LIKE '%<html>%'
  OR p.Tags LIKE '%<css>%'
  OR p.Tags LIKE '%<c++>%')

Enter Parameters

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