answers per question over time (with cw)


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- answers per question over time (with cw)

select *, (answers + 0.0) / (questions + 0.0) [answer per question], votes / (answers + questions + 0.0) [votes per post]
from (
select start, 
       sum(case when PostTypeId = 1 then 1 else 0 end) questions,  
       sum(case when PostTypeId = 2 then 1 else 0 end) answers, 
         select count(*) from Votes v 
join Posts p2 on p2.Id = v.PostId
where VoteTypeId in (2,3) 
and p2.CreationDate between start and finish  
and v.CreationDate between start and finish

       ) as votes

from Posts p
join master.dbo.fnGetDateRanges('m','1-1-2009','1-1-2011') on 
  p.CreationDate between start and finish

group by start,finish
) as X
order by start

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results