ONLY USER to win Bronze+Silver+Gold in a TAG BADGE

2

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

select
  name as [tagbadge],
  userid,
  count(*) as [won]
into #won from badges
where tagbased = 'true'
group by name, userid
having count(*)=3

select 
  name as [tagbadge],
  count(*) as [totalwon]
into #total from badges
where tagbased = 'true'
  and name in ( select tagbadge from #won )
group by name
  
select 
  w.tagbadge as [TagName],
  w.userid as [User Link],
  w.won as [# Won],
  t.totalwon as [Total # Won],
  tg.[count] as [Total # Posts in Tag]
from #won w left join #total t on w.tagbadge=t.tagbadge left join tags tg on tg.tagname=w.tagbadge
where t.totalwon < 6
order by tg.[count] asc

Enter Parameters

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