instruction: First badges of any kind.
response: WITH FirstBadges AS (SELECT * FROM (SELECT UserId, Name, Date, Class, TagBased, ROW_NUMBER() OVER (PARTITION BY UserId, Name, Class ORDER BY Date) AS rn FROM Badges) AS b WHERE b.rn = 1) SELECT ROW_NUMBER() OVER (ORDER BY fb.Date) AS "#", fb.Name AS Name, fb.Class AS Class, fb.Date AS Date FROM FirstBadges AS fb WHERE fb.UserId = '##UserId##' ORDER BY fb.Date