Q&A for professional and amateur woodworkers
declare @pStartDate date = '2018-10-01'
declare @pEndDate date = '2018-12-31'
count(*) as QuestionCount,
sum(A.TriedComments) as TriedCount
sum(case when C.text like '%have you tried%' or c.text like '%whathaveyoutried%' or c.text like '%you have tried%' then 1 else 0 end) as TriedComments,
Posts as P
left join Comments as C on C.PostID = P.ID
P.creationdate between @pStartDate and @pEndDate
and P.posttypeid = 1
) as A