Users with most edits per day

1

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Different

Q&A for power users of Apple hardware and software

;  with editors_cte as
(SELECT
  h.UserId AS uid,
  COUNT(DISTINCT h.RevisionGUID) AS EditCount,
  DATEDIFF(day, u.CreationDate, CAST(GETDATE() AS Date)) AS Days
FROM PostHistory h JOIN Posts p ON h.PostId=p.Id
  JOIN Users u ON u.Id=h.UserId
WHERE (p.PostTypeId in (1,2))
---only questions and answers
  AND (h.PostHistoryTypeId in (1,2,3,4,5,6,7,8,9))
---only edit and rollbacks  
GROUP BY h.UserId, u.CreationDate
)


SELECT TOP(##num?100##)
  uid AS [User Link],
  ROUND(EditCount/(CAST(Days AS decimal)),2) AS [Edits Per Day], 
  EditCount, Days
FROM editors_cte
GROUP BY uid, EditCount, Days
ORDER BY (ROUND(EditCount/(CAST(Days AS decimal)),2)) DESC

Enter Parameters

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