Average Score and Close count Percentage By Year, Month


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT Avg(CAST(score as decimal (10,5))) Avg_Score, 
CAST(SUM(CASE WHEN ClosedDate IS NOT NULL THEN 1 ELSE 0 END) as Decimal(15,5))
/CAST(Count(Id) as decimal(15,5)) CloseCountPercentage, 
       Month(creationdate) month, 
       Year(creationdate)  year 
FROM   posts p 
WHERE  posttypeid = 1 
GROUP  BY Month(creationdate), 
ORDER  BY Year(creationdate), 

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results