Removals of the given phrase per month


Please login or register to vote for this query.

(click on this box to dismiss)


Q&A for researchers, developers, students, teachers, and end users interested in bioinformatics

;  with revisions_cte as
DISTINCT p.Id AS pid, ph1.Id AS phId
FROM PostHistory ph1 INNER JOIN Posts p ON ph1.PostId=p.Id
WHERE ph1.PostHistoryTypeId in (2,5,8)
  and ph1.Text Like '%##word?'
  and NOT(p.Body Like '%##word##%')
), firstrev_cte AS
pid, MIN(ph2.Id) as MinId
  FROM revisions_cte INNER JOIN PostHistory ph2 ON ph2.PostId=pid
  WHERE (ph2.Id>phId)
   AND ph2.PostHistoryTypeId in (2,5,8)
   AND NOT(ph2.Text Like '%##word##%')
--- 2 = Initial Body - initial post raw body text
--- 5 = Edit Body - modified post body (raw markdown)
--- 8 = Rollback Body - reverted body (raw markdown)

SELECT eomonth(CreationDate), Count(PostId) AS [Count]
FROM PostHistory INNER JOIN firstrev_cte ON PostHistory.Id=MinId
GROUP BY eomonth(CreationDate) 
ORDER BY eomonth(CreationDate) DESC

Enter Parameters

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