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 Count] 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