Percentage of posts with "thanks" in them to number of posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

(
select
cast(C.CreationDate as Date) as Created,
Count(C.Id) as [Number of Comments], --*1e2/@numPosts as PercentOfPosts,
'' as [Number of Posts]
from
Comments as C
left join Posts as P on P.Id = C.PostId
where
lower(C.Text) like ##word:string?%thank%##
and
C.CreationDate >= dateadd(##metric?day##, ##numDays?-7##, getdate())
and
P.PostTypeId = iif( ##type:string?answer## = 'answer' , 2 , 1 )
group by
cast(C.CreationDate as Date)

union all

select 
cast(PA.CreationDate as Date) as Created,
'' as [Number of Comments],
Count(PA.Id) as [Number of Posts]
from
Posts as PA
where
PA.CreationDate >= dateadd(##metric?day##, ##numDays?-7##, getdate())
and
PA.PostTypeId = iif( ##type:string?answer## = 'answer' , 2 , 1 )
group by
cast(PA.CreationDate as Date)
)
order by
Created

Enter Parameters

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