select sum(case when p.commentcount = 0 then 1 else 0 end...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select sum(case when p.commentcount = 0 then 1 else 0 end) nocomment
     , sum(case when p.commentcount > 0 then 1 else 0 end) comments
     , sum(case when p.commentcount = 0 and score < 0 then 1 else 0 end) [low score]
     , count(*) [downvoted posts]
     , sum(case when p.commentcount = 0 then 1 else 0 end) / convert(decimal, count(*)) * 100 [% no comment]
     , sum(case when p.commentcount > 0 then 1 else 0 end) / convert(decimal, count(*)) * 100 [% comments]
     , sum(case when p.commentcount = 0 and score < 0 then 1 else 0 end) / convert(decimal, count(*)) * 100 [% low score]
from posts p
where p.id in (select postid from votes where votetypeid = 3)

Enter Parameters

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