Q&A for science fiction and fantasy enthusiasts
/* GOAL 1)Which single user offered points toward bounties? 2)What year did they offer most points? How many points were offered? 3)What year did they create most bounties? How many were created? --Query to locate the biggest spender select users.id, users.DisplayName, sum(votes.bountyamount) as total_bounty from votes inner join users on votes.userid = users.id where votes.bountyamount > 0 group by users.id, users.DisplayName order by sum(votes.bountyamount) desc --B. Clay Shannon, userid = 875317 has offered the most points toward bounty --60350 offered in bounty --Grab all of 875317's bounty votes at a glance by year Select UserId, datepart(yyyy,CreationDate) as Year, BountyAmount from Votes where UserId = 875317 */ Select UserId, datepart(yyyy,CreationDate) as Bounty_Year, sum(BountyAmount) as Bounty_per_Year from Votes where UserId = 875317 group by UserId, datepart(yyyy,CreationDate) order by datepart(yyyy,CreationDate) DESC