DECLARE @badgeweight TABLE ( name 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 @badgeweight TABLE (
    name varchar(100) collate SQL_Latin1_General_CP1_CS_AS,
    weight float)

INSERT @badgeweight
SELECT name, ((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 weight
FROM Badges
WHERE NOT EXISTS (SELECT * FROM tags WHERE tags.tagname=badges.name)
GROUP BY name

SELECT UserId as [User Link] 
FROM Badges
 -- SELECT w.*, Badges.UserId
-- FROM @badgeweight AS w
-- JOIN Badges ON w.name = Badges.name 

Enter Parameters

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