select count(a.id), b.DisplayName from Badges a left j...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Philosophy Meta

Q&A about the site for those interested in the study of the fundamental nature of knowledge, reality, and existence

--declare @ID int 

--select @ID = Id from Users
--where  Reputation =(select max(Reputation)from Users where Location = 'South Africa')
--print @ID

--select Id,Reputation,DisplayName,Location,AboutMe,Views from Users where Id = @ID
--select count(*) as 'Enlightened Badges'from Badges where UserId = @ID 
--and Name = 'Enlightened' 
--and Date like '%2016%'

select count(a.id), b.DisplayName from Badges a
left join Users b  on a.UserId = b.Id
where a.Name = 'Enlightened' and a.Date like '%2016%' and Location = 'South Africa'
and b.Reputation = (select max(Reputation)from Users where Location = 'South Africa')
group by a.id, b.DisplayName

Enter Parameters

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