Count number of votes on competing answers
Q&A for software engineers working on automated testing, continuous delivery, service integration and monitoring, and building SDLC infrastructure
-- How close am I to the Sportsmanship badge? -- Count number of votes on competing answers declare @UserId int = 1707091; with UserPosts as ( select Id as PostId from Posts where OwnerUserId = @UserId and CommunityOwnedDate is null and PostTypeId = 2 and Score >= 1 ) select distinct UserPosts.PostId -- count(unique UserPosts.PostId) as UpVotes from UserPosts inner join Votes on Votes.PostId = UserPosts.PostId where VoteTypeId = 2