Answered rate by score band and month asked

0

Please login or register to vote for this query.

(click on this box to dismiss)

Bicycles

Q&A for people who build and repair bicycles, people who train cycling, or commute on bicycles

declare @epoch datetime = 'March 1, 2014'

select dateadd(month, datediff(month, @epoch, q.CreationDate), @epoch) Month,
       --iif(Score > 0, 'welcome', 'unwelcome') type,
       case 
        when Score < 0 then '< 0'
        when Score = 0 then '0'
        when Score = 1 then '1'
        when Score = 2 then '2'
        when Score = 3 then '3'
        when Score = 4 then '4'
        else '5+'
        end band,
       1.0*count(iif(AnswerCount > 0, 1, null))/count(*) "answer rate"
from PostsWithDeleted q 
where PostTypeId = 1
      and Score between -10 and 10
group by datediff(month, @epoch, q.CreationDate),
       --iif(Score > 0, 'welcome', 'unwelcome'),
      case 
        when Score < 0 then '< 0'
        when Score = 0 then '0'
        when Score = 1 then '1'
        when Score = 2 then '2'
        when Score = 3 then '3'
        when Score = 4 then '4'
        else '5+'
        end
order by band desc, Month;

Enter Parameters

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