Distribution of number of votes on questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

Engineering

Q&A for professionals and students of engineering

-- compute for each question how many votes it has 
--(question means posttypeid = 1)
with a as (
   Select p.Id, Count(v.PostId) n_votes
   from Votes v full outer join Posts p 
   on v.PostId = p.Id
   where p.PostTypeId in (1) and v.VoteTypeId in (2,3)
   group by p.Id
)


-- Create histogram
select pp.Id, n_votes
from a full outer join Posts pp 
on a.Id = pp.id
where pp.PostTypeId in (1)
order by pp.Id desc

Enter Parameters

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