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) ;