How often is somebody the top editor?


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
  UserId, UserDisplayName,
  COUNT(DISTINCT RevisionGUID) AS CountEdits,
  CAST(CreationDate as Date) AS DateEdits
  FROM PostHistory WHERE (PostHistoryTypeId in (4,5,6))
  GROUP BY UserId, UserDisplayname, CAST(CreationDate as Date)
, maxedits_cte as
  MAX(CountEdits) AS MaxEdits,
FROM editors_cte
GROUP BY DateEdits

SELECT e.UserId AS [User Link], e.UserDisplayName, COUNT(*) as NumberDays
FROM  editors_cte e INNER JOIN maxedits_cte m ON e.DateEdits=m.DateEdits
WHERE e.CountEdits=m.MaxEdits
GROUP BY e.UserId, e.UserDisplayName
ORder BY NumberDays DESC

Enter Parameters

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