Common post scores

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

create table #PostScores
(
 Score int
)

insert into #PostScores (Score)
select -5 union all
select -4 union all
select -3 union all
select -2 union all
select -1 union all
select 0 union all
select 1 union all
select 2 union all
select 3 union all
select 4 union all
select 5

select
 ps.Score,
 (select count(p.Id) from Posts p where p.Score = ps.Score)
from #PostScores ps

Enter Parameters

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