Q&A for designers and implementers of computer programming languages
SELECT TOP ##num?100## RANK() OVER(ORDER BY SUM(a.Score) DESC) AS [Rank], a.OwnerUserId AS [User Link], a.OwnerDisplayName, SUM(a.Score) AS [Total Score], COUNT(a.Id) AS [Num Answers], SUM(case when a.CommunityOwnedDate is NULL then a.Score else 0 end) AS [Non-CW Score], SUM(case when a.CommunityOwnedDate is NULL then 1 else 0 end) AS [Non-CW Answers] FROM Posts a JOIN Posts q ON a.ParentId=q.Id INNER JOIN PostTags pt ON q.Id = pt.PostId INNER JOIN Tags t ON pt.TagId = t.Id WHERE t.TagName=##tagName:string?discussion## GROUP BY a.OwnerUserId, a.OwnerDisplayName ORDER BY SUM(a.Score) DESC