Questions with the most links

0

Please login or register to vote for this query.

(click on this box to dismiss)

MathOverflow

Q&A for professional mathematicians

WITH AllLinks AS (SELECT PostId, RelatedPostId
  FROM PostLinks
  WHERE LinkTypeId = 1 -- linked question
UNION -- sometimes, a question pair appears in both orders
SELECT RelatedPostId, PostId
  FROM PostLinks
  WHERE LinkTypeId = 1 -- linked question
)
SELECT TOP 100
  PostId AS [Post Link],
  'site://questions/linked/' + CAST(PostId AS NVARCHAR) + '|' +
  CAST(COUNT(*) AS NVARCHAR) + ' linked questions' AS 'Links'
  FROM AllLinks AS l
  
-- PostLinks contains links to deleted questions as well;
-- this makes sure they still exist.
  INNER JOIN Posts AS p ON l.RelatedPostId = p.Id
  
  GROUP BY PostId
  ORDER BY COUNT(*) DESC

Enter Parameters

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