Users with highest comments to posts ratio


Please login or register to vote for this query.

(click on this box to dismiss)

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

;with ccounts_cte AS (
  UserId AS uid,
  UserDisplayName AS udn,
  COUNT(Id) AS Ccount
  FROM Comments
  GROUP BY UserId, UserDisplayName
), pcounts_cte AS (
  OwnerUserId AS uid,
  OwnerDisplayName AS udn,
  COUNT(Id) AS Pcount,
  SUM(case when PostTypeId = 1 then 1 else 0 end) AS QCount,
  SUM(case when PostTypeId = 2 then 1 else 0 end) AS ACount
  FROM Posts
  GROUP BY OwnerUserId, OwnerDisplayName

SELECT TOP(##num?100##)
  c.uid AS [User Link], c.udn AS [DisplayName],
  ROUND((CAST(c.CCount AS decimal))/(CAST(p.PCount AS decimal)),2) AS [Ratio],
  c.CCount AS [Comments #],
  p.PCount AS [Posts #],
  p.ACount AS [Answers #],
  p.QCount AS [Questions #]
FROM ccounts_cte c INNER JOIN pcounts_cte p ON ((c.uid=p.uid))
WHERE (p.PCount>0) AND (p.PCount>=##min?10##)
ORDER BY (CAST(c.CCount AS decimal))/(CAST(p.PCount AS decimal)) DESC

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results