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


Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

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

  name as [tagbadge],
  count(*) as [totalwon]
into #total from badges
where tagbased = 'true'
  and name in ( select tagbadge from #won )
group by name
  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

Switch sites:
loading Hold tight while we fetch your results