SELECT p1.Id AS QuestionId, AVG(p2.Score) AS AverageAnswe...

0

Please login or register to vote for this query.

(click on this box to dismiss)

SharePoint Meta

Q&A about the site for SharePoint enthusiasts

SELECT
    p1.Id AS QuestionId,
    AVG(p2.Score) AS AverageAnswerScore
FROM
    Posts p1
JOIN
    Posts p2 ON p1.Id = p2.ParentId
WHERE
    p1.PostTypeId = 1  -- PostTypeId = 1 indicates that the post is a question
    AND p2.PostTypeId = 2  -- PostTypeId = 2 indicates that the post is an answer
GROUP BY
    p1.Id, p1.Title
HAVING
    COUNT(p2.Id) >= 5

Enter Parameters

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