Questions and Answers per Day

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

select [Week], 
       sum(case when PostTypeId = 1 then 1 else 0 end) Questions,
       sum(case when PostTypeId = 1 then 0 else 1 end) Answers,
       10
from
(
  select
  CONVERT(DATE, DATEADD(day, -1*(DATEDIFF(day, CreationDate, GETDATE()) % 7), CreationDate)) [Week],
    PostTypeId
     
  from Posts p
) as X
group by [Week]
order by [Week] asc

Enter Parameters

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