User Badges

1

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A about the site for music historians, critics, and fans

DECLARE @UserId INT = ##UserId:INT##

SELECT
-- b - Badges Table
-- u - Users Table

    ROW_NUMBER() OVER (ORDER BY b.Id ASC) AS '#',
    -- instead of 
    --b.Id AS 'ID'
    b.Name AS 'Name',
    b.Date AS 'Awarded',
    b.Class AS 'Badge',
    b.TagBased AS 'Tag-Based',
    u.DisplayName AS 'User'
    -- instead of 
    --b.UserId AS 'UserId'

FROM Badges AS b
Join Users AS u ON b.UserId = u.Id

WHERE b.UserId = @UserId

ORDER BY b.Id ASC

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results