Q&A for scientists using computers to solve scientific problems
WITH ActionHistory AS ( SELECT 'Posting' Type, p.Id, p.CreationDate, p.OwnerUserId UserId FROM Posts p WHERE PostTypeId IN (1,2) UNION ALL SELECT 'Commenting' Type, c.Id, c.CreationDate, c.UserId FROM Comments c UNION ALL SELECT 'Editing' Type, h.Id, h.CreationDate, h.UserId FROM PostHistory h WHERE PostHistoryTypeId IN (4,5,6) ) SELECT TOP 10 UserId [User Link], COUNT(*) TotalActions FROM ActionHistory WHERE CreationDate > DATEADD(month, -1, GETUTCDATE()) GROUP BY UserId ORDER BY COUNT(*) DESC