Protected questions by month

0

Please login or register to vote for this query.

(click on this box to dismiss)

English

Q&A for linguists, etymologists, and serious English language enthusiasts

select dateadd(month, datediff(month, 0, h.CreationDate), 0) mo, 
  count(*) ProtectedQuestions,
  count(iif(h.UserId=-1, 1, null)) SystemProtected,
  count(iif(h.UserId<>-1, 1, null)) UserProtected  
from PostHistory h
where PostHistoryTypeId=19 -- protected
and not exists (select 1 from PostHistory h2 
  where h2.PostId=h.PostId 
  and h2.PostHistoryTypeId=20 -- unprotected
  and h2.CreationDate > h.CreationDate)
  
group by dateadd(month, datediff(month, 0, h.CreationDate), 0)
order by dateadd(month, datediff(month, 0, h.CreationDate), 0)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results