My average normalized score

0

Please login or register to vote for this query.

(click on this box to dismiss)

Your share in total score received by all answers to the questions you answered (includes answers with score >=0 and questions with total score of answers >0)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Enter Query Title
-- Enter Query Description

DECLARE @UserId int = ##UserId##

SELECT AVG(a.NormalizedScore)
FROM
    (SELECT (CAST(a.Score AS float) / SUM(allA.Score)) * 100 AS NormalizedScore
    FROM Posts a 
        JOIN Posts q ON a.ParentId = q.Id
        JOIN Posts allA ON allA.ParentId = q.Id
    WHERE a.PostTypeId = 2 and a.OwnerUserId = @UserId
          and a.Score >= 0 and allA.score > 0
    GROUP BY a.Id, a.Score
    HAVING SUM(allA.Score) > 0) AS a

Enter Parameters

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