Duplicates for [Post]

1

Please login or register to vote for this query.

(click on this box to dismiss)

Lists all duplicates with a given post as the target. The target itself is listed first, followed by all dupes sorted by post date, including deleted ones, most recent posts first.

Meta Stack Exchange

Q&A for meta-discussion of the Stack Exchange family of Q&A websites

SELECT
  'Target:' AS [#####],
  CONCAT('site://q/', pwd.Id, '|', CASE 
    WHEN pwd.DeletionDate IS NULL
    THEN pwd.Title
    ELSE '[deleted]'
    END
  ) AS [Post],
  pwd.CreationDate AS [Date Posted],
  NULL AS [Date Linked]
FROM PostsWithDeleted pwd
WHERE pwd.Id = ##OriginalPostId:int##
UNION ALL
SELECT 
  '' AS [#####],
  CONCAT('site://q/', pl.PostId, '|', CASE 
    WHEN pwd.DeletionDate IS NULL
    THEN pwd.Title
    ELSE '[deleted]'
    END
  ) AS [Post],
  pwd.CreationDate AS [Date Posted],
  pl.CreationDate AS [Date Linked]
FROM PostLinks pl
JOIN PostsWithDeleted pwd ON pwd.Id = pl.PostId
WHERE RelatedPostId = ##OriginalPostId:int##
  AND LinkTypeId = 3 -- Type for Duplicates
ORDER BY [#####] DESC, [Date Posted] DESC

Enter Parameters

Options:
Switch sites
loading Hold tight while we fetch your results