Average answer score

0

Please login or register to vote for this query.

(click on this box to dismiss)

SharePoint

Q&A for SharePoint enthusiasts

DECLARE @UserId INT = ##UserId##;

-- Calculate average scores for answers, questions, and total posts
SELECT 
    AVG(CASE WHEN p.PostTypeId = 2 THEN p.Score END) AS AverageAnswerScore,
    AVG(CASE WHEN p.PostTypeId = 1 THEN p.Score END) AS AverageQuestionScore,
    AVG(p.Score) AS AveragePostScore
FROM 
    Posts p
WHERE 
    p.OwnerUserId = @UserId

Enter Parameters

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