Hi there. A brief question. I'm creating a query to list users with highest number of sites having a given badge. I made one but it is counting the total number of badges across all sites. This inflates the numbers.
my code:
select top 100 b.userid, u.displayname, count(*) as gold
from badges b
inner join users u on u.id = b.userid
where name in ('BADGE')
group by b.userid, u.displayname
order by gold desc
I feel I only need a small tweek
but can't figure it out
my code:
select top 100 b.userid, u.displayname, count(*) as gold
from badges b
inner join users u on u.id = b.userid
where name in ('BADGE')
group by b.userid, u.displayname
order by gold desc
I feel I only need a small tweek
but can't figure it out