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

1

Please login or register to vote for this query.

(click on this box to dismiss)

Biblical Hermeneutics Meta

Q&A about the site for professors, theologians, and those interested in exegetical analysis of biblical texts

---see also: Number of spam posts that lasted at least ten minutes (per month)
--- https://data.stackexchange.com/mathoverflow/query/1768123/number-of-spam-posts-that-lasted-at-least-ten-minutes-per-month#graph

;  with spam_cte as
(SELECT DISTINCT 
  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
(SELECT 
  eomonth(cre) AS Month,
  COUNT(pid) AS CountAll,
  SUM(case when (minutes>=##min?10##) then 1 else 0 end) AS CountLong
FROM spam_cte
GROUP BY eomonth(cre)
)

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

Enter Parameters

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