Number of spam posts that lasted at least ten minutes (per week)

1

Please login or register to vote for this query.

(click on this box to dismiss)

GIS

Q&A for cartographers, geographers and GIS professionals

;  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))

SELECT
  DATEADD(dd, -(DATEPART(dw, cre)-1), CAST(cre AS Date)) [WeekStart], 
  COUNT(pid) AS [Count]
FROM spam_cte
WHERE (minutes>=##min?10##)
GROUP BY DATEADD(dd, -(DATEPART(dw, cre)-1), CAST(cre AS Date))
ORDER BY DATEADD(dd, -(DATEPART(dw, cre)-1), CAST(cre AS Date))

Enter Parameters

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