SELECT Month = DATEADD(MONTH, DATEDIFF(MONTH, 0, Creation...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT Month = DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0),
       Quality = CAST(SUM(CASE WHEN Score > 0 THEN 1 ELSE 0 END) AS FLOAT) /
                 SUM(CASE WHEN (Score < 0 OR Score > 0) THEN 1 ELSE 0 END)
FROM POSTS
/*WHERE DATEDIFF(MONTH, '2011/06/01', CreationDate) <= 0*/
GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0)
ORDER BY Month

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results