Historical question grades by week


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @start datetime = '2017-10-08';

select dateadd(week, datediff(week, @start, CreationDate), @start) week,
       sum(iif((ClosedDate <= CreationDate+3 /*and IsClosedAsDuplicate = 0*/)
                or Score < 0
                or DeletionDate <= CreationDate+3, 1.0, 0))/count(*) bad,
       sum(iif(Score < 0, 1.0, 0))/count(*) downvoted,
       sum(iif(ClosedDate <= CreationDate+3 /*and IsClosedAsDuplicate = 0*/, 
               1.0, 0))/count(*) closed,
       sum(iif(DeletionDate <= CreationDate+3, 1.0, 0))/count(*) deleted
from PostsWithDeleted
where PostTypeId = 1
group by dateadd(week, datediff(week, @start, CreationDate), @start)
order by dateadd(week, datediff(week, @start, CreationDate), @start)

Enter Parameters

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