Most Controversial Posts

1

Please login or register to vote for this query.

(click on this box to dismiss)

Classified by at least half as many down-votes as up-votes. Ordered by total votes.

Stack Overflow

Q&A for professional and enthusiast programmers

-- Most Controversial Posts
-- Classified by at least half as many down-votes as up-votes.
-- Ordered by total votes.

select top 20
    v.*,
    p.Id [Post Link]
from
    Posts p
inner join
  (
    select
        PostId,
        sum(case when VoteTypeId = 2 then 1 else 0 end) up,
        sum(case when VoteTypeId = 3 then 1 else 0 end) down
    from
        Votes
    group by
        PostId
  ) v
  on
    p.Id = v.PostId
where
    v.down > v.up * 0.5
order by
    up + down desc,
    up desc,
    id asc

Enter Parameters

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