Counts the number of edits a user has made to posts
Q&A for professional and enthusiast programmers
-- User Edit Count -- Counts the number of edits a user has made to posts DECLARE @UserId int = ##UserId## SELECT COUNT(*) FROM PostHistory WHERE PostHistoryTypeId IN ( SELECT Id FROM PostHistoryTypes WHERE Name = 'Edit Title' OR Name = 'Edit Body' ) AND UserId = @UserId AND PostId NOT IN ( SELECT Id FROM Posts WHERE OwnerUserId = @UserId )