SELECT TOP 50 Posts.Id, b.NumberOfDuplicates FROM Posts I...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT TOP 50 Posts.Id, b.NumberOfDuplicates
FROM Posts
INNER JOIN (SELECT Posts.Id, COUNT(PostLinks.RelatedPostId) AS NumberOfDuplicates
FROM Posts, PostLinks
WHERE Posts.Id = PostLinks.RelatedPostId AND PostLinks.LinkTypeId = 3
GROUP BY Posts.Id) AS b ON Posts.Id=b.Id
ORDER BY b.NumberOfDuplicates DESC

Enter Parameters

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