Q&A for SharePoint enthusiasts
SELECT COUNT(DISTINCT p.Id) AS BountyQuestionsCount FROM Posts p JOIN Votes v ON p.Id = v.PostId WHERE p.PostTypeId = 1 -- Filter for questions AND v.VoteTypeId = 8; -- VoteTypeId = 8 corresponds to bounties