Q&A for professional and enthusiast programmers
SELECT TOP ##Number## a.Id AS [Post Link], b.NumberOfDuplicates FROM Posts AS a LEFT 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 a.Id = b.Id WHERE Tags LIKE '%python%' AND Tags LIKE '%regex%' ORDER BY b.NumberOfDuplicates DESC; -- Number: Number of posts to show: