Questions with closest number of up- and downvotes and positive total


Please login or register to vote for this query.

(click on this box to dismiss)

Shows the questions that come closest to having the same number of up- and downvotes, but still have a positive total. The difference is expressed as a percentile ratio of total upvotes, i.e., the difference between the number of up- and downvotes as a percentage of the total number of upvotes. For example, a post with 10 upvotes and 9 downvotes has a difference of 1 vote = 10% of of 10 upvotes = 10% ratio.

Science Fiction and Fantasy

Q&A for science fiction and fantasy enthusiasts

set nocount on 

declare @VoteStats table (PostId int, up int, down int) 

insert @VoteStats
    up = sum(case when VoteTypeId = 2 then 1 else 0 end), 
    down = sum(case when VoteTypeId = 3 then 1 else 0 end)
from Votes
where VoteTypeId in (2,3)
group by PostId

set nocount off

select top 100 as [Post Link], up, down, (cast((down - up) as decimal) / down * 100) as ratio from @VoteStats 
join Posts p on PostId = p.Id
where down > up and down > 7 and p.CommunityOwnedDate is null
order by ratio asc, down desc, up desc

Enter Parameters

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