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.

SharePoint

Q&A for SharePoint enthusiasts

-- 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 to meta site
loading Hold tight while we fetch your results