DECLARE @badges TABLE ( badgeid int, badgeweight float) ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Role-playing Games

Q&A for gamemasters and players of tabletop, paper-and-pencil role-playing games

-- Enter Query Title
-- Enter Query Description

DECLARE @badges TABLE (
    badgeid int,
    badgeweight float)

INSERT @badges
SELECT DISTINCT id as badgeid,((SELECT TOP 1 count(Name) FROM Badges WHERE NOT EXISTS (SELECT * FROM tags WHERE tags.tagname=badges.name) GROUP BY name ORDER BY count(Name) DESC)+0.0) / count(Name) as badgeweight
FROM badges
WHERE NOT EXISTS (SELECT * FROM tags WHERE tags.tagname=badges.name)
GROUP BY id

SELECT TOP 20 UserId AS [User Link], count(*) as Badges
FROM Badges
GROUP BY UserId
ORDER BY Badges DESC

Enter Parameters

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