Rank by Tag-Based Badge Count

1

Please login or register to vote for this query.

(click on this box to dismiss)

Sitecore

Q&A for developers and end users of the Sitecore CMS and multichannel marketing software

SELECT TOP(100) 
      u.DisplayName
    , [Count of Badges] = COUNT(b.id)
    , [Rank] = RANK() OVER (ORDER BY COUNT(b.id) DESC)
FROM 
      Users u
      INNER JOIN Badges b ON u.id = b.UserId
WHERE 
      b.TagBased = 1
GROUP BY 
      u.DisplayName
ORDER BY 
      COUNT(b.id) DESC;

Enter Parameters

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