Average score of accepted answers in YEAR


Please login or register to vote for this query.

(click on this box to dismiss)


Q&A for SharePoint enthusiasts

select YEAR(v.creationdate) AS "Acceptance Year", 
AVG(cast(a.score AS decimal)) AS "Average Score", 
MIN(a.score) AS "Min Score", 
MAX(a.score) AS "Max Score",
COUNT(*) AS "Score Count" 
from posts q 
join posts a on q.acceptedanswerid = a.id --- join q's with a's
join votes v on a.id = v.postid
where q.posttypeid=1 --- questions
and q.AcceptedAnswerId IS NOT NULL
and v.votetypeid=1 --- accepted by originator
group by YEAR(v.creationdate)

Enter Parameters

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