User Badges

1

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

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 meta site
loading Hold tight while we fetch your results