Questions and Answers per Month

0

Please login or register to vote for this query.

(click on this box to dismiss)

Joomla Meta

Q&A about the site for Joomla! administrators, users, developers and designers

select [Month],
       Questions,
       Answers,
       (Answers * 1000 / Questions) as Ratio
from
(
select [Month], 
       sum(case when PostTypeId = 1 then 1 else 0 end) as Questions,
       sum(case when PostTypeId = 2 then 1 else 0 end) as Answers
from
(
  select CAST(
      cast(DATEPART(YYYY, CreationDate) as varchar) + '-' + cast(DATEPART(MM, CreationDate) as varchar) + '-01'
    as datetime) [Month], 
    PostTypeId
     
  from Posts p
) as X
group by [Month]

) as Y
order by [Month] asc

Enter Parameters

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