My Comment Score distribution (forked, trying to figure out total score)

0

Please login or register to vote for this query.

(click on this box to dismiss)

How many comments do I have for each score.

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

DECLARE @UserId int = ##UserId##
DECLARE @CommentCount int = COUNT(*)
DECLARE @CommentScore int
SELECT 
    Count(*) AS CommentCount,
    @CommentScore AS Score,
    @CommentCount * @CommentScore AS [TotalScore]
FROM 
    Comments
WHERE 
    UserId = @UserId
GROUP BY 
    Score
ORDER BY 
    Score DESC

Enter Parameters

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