How many upvotes do I have towards tag-specialist badges?

2

Please login or register to vote for this query.

(click on this box to dismiss)

Change from original with CW: it's question status that counts.

SharePoint

Q&A for SharePoint enthusiasts

-- How many upvotes do I have towards tag-specialist badges?
-- Change from original with CW: it's question status that counts.

-- Original: http://odata.stackexchange.com/stackoverflow/s/137/how-many-upvotes-do-i-have-towards-tag-specialist-badges

-- Exclude CW answers because I think that also disqualifies them.

DECLARE @UserId int = ##UserId##

SELECT TOP 40 
    TagName,
    COUNT(*) AS UpVotes 
FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts Answer ON Answer.ParentId = PostTags.PostId
    INNER JOIN Votes ON Votes.PostId = Answer.Id and VoteTypeId = 2
    INNER JOIN Posts Question ON Answer.ParentId = Question.Id
WHERE 
    Answer.OwnerUserId = @UserId
    AND Answer.CommunityOwnedDate IS NULL
    AND Question.CommunityOwnedDate IS NULL
GROUP BY TagName 
ORDER BY UpVotes DESC

Enter Parameters

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