Posts by number of close votes

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

with post_votes as (
select p.id
     , count(v.id) as ct
     , p.score
  from posts p
  join votes v
    on p.id = v.postid
 where v.votetypeid = 6
   and p.closeddate is null
 group by p.id, p.score
       )
select ct as [# Close Votes]
     , count(*) as [# Posts]
     , sum(case when score < 0 then 1 else 0 end) as [Minus Score]
     , sum(case when score = 0 then 1 else 0 end) as [0 Score]
     , sum(case when score > 0 then 1 else 0 end) as [Plus Score]
  from post_votes
 group by ct

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results