Users with lowest comments to posts ratio

1

Please login or register to vote for this query.

(click on this box to dismiss)

Blender Meta

Q&A about the site for people who use Blender to create 3D graphics, animations, or games

;with ccounts_cte AS (
SELECT
  UserId AS uid,
  UserDisplayName AS udn,
  COUNT(Id) AS Ccount
  FROM Comments
  GROUP BY UserId, UserDisplayName
), pcounts_cte AS (
SELECT
  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)) ASC

Enter Parameters

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