Q&A for Salesforce administrators, implementation experts, developers and anybody in-between
WITH ActionHistory AS ( SELECT 'Posting' Type, p.CreationDate, p.OwnerUserId UserId FROM Posts p WHERE PostTypeId IN (1,2) UNION ALL SELECT 'Commenting' Type, c.CreationDate, c.UserId FROM Comments c UNION ALL SELECT 'Editing' Type, 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