Questions and Answers per Day

1

Please login or register to vote for this query.

(click on this box to dismiss)

Software Engineering

Q&A for professionals, academics, and students working within the systems development life cycle

select [Month], 
       sum(case when PostTypeId = 1 then 1 else 0 end) Questions,
       sum(case when PostTypeId = 1 then 0 else 1 end) Answers
from
(
  select CAST(
      cast(DATEPART(YYYY, CreationDate) as varchar) + '-' + cast(DATEPART(MM, CreationDate) as varchar) + '-' + cast(DATEPART(DD, CreationDate) as varchar)
    as date) [Month], 
    PostTypeId
     
  from Posts p
  where CreationDate < dateadd(month,datediff(m,0,GETDATE()),0)
) as X
group by [Month]
order by [Month] asc

Enter Parameters

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