Q&A about the site for information security professionals
select datepart(yyyy, creationdate) as [Year] , datepart(q, creationdate) as [Quarter] , sum(case when acceptedanswerid is not null then 1 else 0 end ) as [Accepted] , sum(case when acceptedanswerid is null then 1 else 0 end ) as [Not Accepted] , round(cast(count(acceptedanswerid) as float ) / cast(count(*) as float) , 3) as [Accept Rate] from posts where posttypeid = 1 and closeddate is null and answercount > 0 group by datepart(yyyy, creationdate) , datepart(q, creationdate) order by datepart(yyyy, creationdate) , datepart(q, creationdate)