DECLARE @badges TABLE ( badgename varchar(100) collate S...

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 (
    badgename varchar(100) collate SQL_Latin1_General_CP1_CS_AS,
    badgecount int,
    badgeweight float)

INSERT @badges
SELECT DISTINCT name AS badgename, count(name) AS badgecount, (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) / count(Name) as badgeweight
FROM badges
WHERE NOT EXISTS (SELECT * FROM tags WHERE tags.tagname=badges.name)
GROUP BY name

SELECT TOP(100) users.id as [User Link]
FROM users
WHERE reputation > 5000

Enter Parameters

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