Q&A for designers and implementers of computer programming languages
SELECT TOP(##num?100##) t.TagName, SUM(v.BountyAmount) [Total amount], COUNT(v.Id) [Number of bounties] FROM Votes v INNER JOIN Posts p ON v.PostId=p.Id INNER JOIN PostTags pt ON p.Id = pt.PostId INNER JOIN Tags t ON pt.TagId = t.Id WHERE (v.VoteTypeId=8) --- 8 = BountyStart (UserId and BountyAmount will also be populated) GROUP BY t.TagName ORDER BY SUM(v.BountyAmount) DESC