4. What percentage of posts have no comments attached to them?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

SELECT
COUNT(*) AS Num_Posts,
SUM(CASE WHEN C.PostId IS NULL THEN 1 ELSE 0 END) AS Posts_NoComments,
SUM(CASE WHEN C.PostId IS NULL THEN 1 ELSE 0 END) / (COUNT(*)) *100 AS Percent_NoComments
FROM Posts P
LEFT JOIN Comments C
ON C.PostId = P.Id

Enter Parameters

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