How close am I to the Sportsmanship badge?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Count number of votes on competing answers

Stack Overflow

Q&A for professional and enthusiast programmers

-- How close am I to the Sportsmanship badge?
-- Count number of votes on competing answers

declare @UserId int = ##UserId##;

with UserPosts as (
  select
    Id as PostId
  from
    Posts
  where
    OwnerUserId = @UserId and
    CommunityOwnedDate is null and
    PostTypeId = 2 and
    Score >= 1
)

select count(distinct UserPosts.PostId)
--  count(unique UserPosts.PostId) as UpVotes
from
  UserPosts
  inner join Votes on Votes.PostId = UserPosts.PostId
where
  VoteTypeId = 2

Enter Parameters

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