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