whyt

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

declare @pStartDate date = '2012-10-01'
declare @pEndDate date = '2012-12-31'

select
  count(*) as QuestionCount,
  sum(A.TriedComments) as TriedCount
from
  (
  select
    sum(case when C.text like '%have you tried%' or c.text like '%you have tried%' then 1 else 0 end) as TriedComments,
    P.ID
  from
    Posts as P
    left join Comments as C on C.PostID = P.ID 
  where    
    P.creationdate between @pStartDate and @pEndDate
    and P.posttypeid = 1
  group by
    P.ID
    ) as A

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached