Average score of accepted answers in YEAR

0

Please login or register to vote for this query.

(click on this box to dismiss)

Martial Arts

Q&A for students and teachers of all martial arts

select YEAR(v.creationdate) AS "Acceptance Year", 
AVG(cast(a.score AS decimal)) AS "Average Score", 
STDEV(a.score) AS "Std Dev 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

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