Number of body edits per question

0

Please login or register to vote for this query.

(click on this box to dismiss)

Distribution of the number of body edits per question

Interpersonal Skills Meta

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

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results