Number of Close and Reopen TasksReviews per quarter

0

Please login or register to vote for this query.

(click on this box to dismiss)

Statistical Analysis

Q&A for people interested in statistics, machine learning, data analysis, data mining, and data visualization

With a as (Select 
     Id,
     ReviewTaskTypeId,
     DATEPART(YYYY, CreationDate) +
     1.00*FLOOR((DATEPART(MM,   CreationDate)-1.00)/3)/4  as [Month], 
     case when DATEDIFF(dd, CreationDate, DeletionDate)=0 
             then 'same day'
          when DATEDIFF(dd, CreationDate, DeletionDate)=1 
             then 'next day'
          when DATEDIFF(dd, CreationDate, DeletionDate)>1 
             then 'longer'
     end as [Duration]
from ReviewTasks
where   DATEPART(YYYY, CreationDate) +
        1.00*FLOOR((DATEPART(MM,   CreationDate)-1.00)/3)/4 <
        DATEPART(YYYY, GETDATE()) +
        1.00*FLOOR((DATEPART(MM,   GETDATE())-1.00)/3)/4
        and  ReviewTaskTypeId in (2,6)
)

Select [Month], [Duration],  Count(Id) 
from a
group by [Month], [Duration]
order by [Month]

Enter Parameters

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