select x.cdate, x.posttypeid, x.dreasion, count(x.id) as ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Writing

Q&A for the craft of professional writing, including fiction, non-fiction, technical, scholarly, and commercial writing

select x.cdate, x.posttypeid, x.dreasion, count(x.id) as cnt
from (
    select id
         , cast(creationdate as date) as cdate
         , posttypeid
         , case when (deletiondate is not null and parentid is not null) then 'Ans'
                when (deletiondate is not null and parentid is null) then 'Que'
                else 'Ali'
                end as dreasion
       from postswithdeleted
       where creationdate >= '2013-11-30'
       and posttypeid in ('1', '2')
   ) x
group by x.cdate, x.posttypeid, x.dreasion
  ;

Enter Parameters

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