Active bounties in a tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Lists all posts that have had a bounty opened

Stack Overflow

Q&A for professional and enthusiast programmers

CREATE TABLE #BountyQuestion (Id int, Score int, Tags nvarchar (150))
INSERT #BountyQuestion
SELECT Posts.Id, Posts.Score, Posts.Tags
FROM Posts
    INNER JOIN Votes             ON Posts.Id       = Votes.PostId
    INNER JOIN PostTags          ON Posts.Id       = PostTags.PostId
    INNER JOIN Tags              ON PostTags.TagId = Tags.id
WHERE   Posts.PostTypeId         = 1         -- PostTypeId = 1 ->Question
    AND Votes.VoteTypeId         = 8         -- VoteTypeId = 8 -> BountyStart
    AND AnswerCount              = 0
    AND Tags.TagName   = '##TagName##'


SELECT Id AS [Post Link], Score, Tags FROM #BountyQuestion
--EXCEPT 
--SELECT Id FROM #BountyQuestion
--WHERE NOT 9 IN (
--             SELECT Votes.VoteTypeId FROM Votes, Posts Answers 
--                WHERE Votes.PostId = Answers.Id
--                AND Answers.ParentId=#BountyQuestion.Id
--            )

Enter Parameters

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