Percentage of spam posts that lasted at least N minutes (per week)


Please login or register to vote for this query.

(click on this box to dismiss)

Genealogy and Family History Meta

Q&A about the site for expert genealogists and people interested in genealogy or family history

---see also: Number of spam posts that lasted at least ten minutes (per week)

;  with spam_cte as
  p.Id AS pid,
  DATEDIFF(minute, p.CreationDate, p.DeletionDate) AS Minutes,
  p.CreationDate AS cre,
  p.DeletionDate AS del
FROM PostsWithDeleted p INNER JOIN Votes v ON v.PostId=p.Id
WHERE v.VoteTypeId=##votetype?12## 
AND (p.DeletionDate IS NOT NULL))
, counts_cte as
  DATEADD(dd, -(DATEPART(dw, cre)-1), CAST(cre AS Date)) AS WeekStart,
  COUNT(pid) AS CountAll,
  SUM(case when (minutes>=##min?10##) then 1 else 0 end) AS CountLong
FROM spam_cte
GROUP BY DATEADD(dd, -(DATEPART(dw, cre)-1), CAST(cre AS Date))

  ROUND(CountLong*100.0/CountAll,2) AS percentage
FROM counts_cte
ORDER BY WeekStart

Enter Parameters

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