select u.displayname, count(b.id) as BadgeCount from use...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Signal Processing Meta

Q&A about the site for practitioners of the art and science of signal, image and video processing

--declare @BadgeCount int = sum(select COUNT(Id) from Badges where Name = 'Enlightened')
--select Distinct TOP 1 u.AccountId, u.Reputation, u.DisplayName, u.Location from Users u
--JOIN Badges b 
--ON u.AccountId = b.UserId
--where u.Location like '%South Africa' 
--And b.Id = @BadgeCount
--And b.Date >= '2016-01-01' and b.Date <= '2016-12-31'
--group by u.DisplayName
--order by u.Reputation desc

select u.displayname, count(b.id) as BadgeCount
from users u
join badges b on u.accountid=b.userid
where u.reputation = (select max(reputation) from users where location = 'south africa')
and u.Location = '%South Africa'
and year(b.date) = 2016
group by u.displayname

--What is the name of the most reputable "South Africa" user 
--and how many "Enlightened" badges did they receive in 2016?

--select TOP 1 * from Users where Location like '%South Africa'
--order by Reputation Desc

--select * from Badges where Name = 'Enlightened' and year(Date) = 2016

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results