Distribution of the number of body edits per question
Q&A about the site for people looking to improve their interpersonal communication skills
-- Number of body edits per question -- Distribution of the number of body edits per question CREATE TABLE #EditCounts (Id int NOT NULL, Edits int NOT NULL) go INSERT INTO #EditCounts SELECT ph.PostId AS [Id], Count(*) AS [Edits] FROM PostHistory ph WHERE PostHistoryTypeId = 5 GROUP BY ph.PostId go WITH TotalQuestions AS ( SELECT Cast(Count(*) AS FLOAT) AS Count FROM Posts WHERE PostTypeId = 1 ) SELECT IsNull(e.Edits, 0) AS [Edits], Count(*) AS [Questions], Round(Count(*) / (SELECT Count FROM TotalQuestions) * 100, 1) As [Percent] FROM Posts p LEFT JOIN #EditCounts e ON e.Id = p.Id WHERE p.PostTypeId = 1 GROUP BY e.Edits ORDER BY Edits