Who attracted the most people into the system

1

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

WITH FirstQuestions AS (
  SELECT
    OwnerUserId,
    RANK() OVER (PARTITION BY OwnerUserId ORDER BY Id) AS Rank,
    PostTypeId,
    AcceptedAnswerId
  FROM Posts
  WHERE OwnerUserId IS NOT NULL
),
AttractedUsers AS (
  SELECT
    A.OwnerUserId,
    COUNT(*) AS Count
  FROM FirstQuestions, Posts A
  WHERE
    FirstQuestions.Rank = 1
    AND
    FirstQuestions.AcceptedAnswerId = A.Id
    AND
    A.OwnerUserId IS NOT NULL
  GROUP BY A.OwnerUserId
)
SELECT TOP 4000
  DENSE_RANK() OVER (ORDER BY Count DESC) AS Rank,
  OwnerUserId AS [User Link],
  OwnerUserId AS [User Id],
  Count
FROM AttractedUsers
ORDER BY Count DESC, OwnerUserId

Enter Parameters

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