Determines where you rank in a given tag as of the last data load
Q&A for professional and enthusiast programmers
-- What percentile am I in for a given tag? -- Determines where you rank in a given tag as of the last data load SELECT TOP 501 STR(NTILE(10000) OVER(ORDER BY SUM(answers.score) DESC), 3) + '' AS [Top], ROW_NUMBER() OVER(ORDER BY SUM(answers.score) DESC) AS [Ranking], Users.Id AS [User Link], SUM(answers.Score) AS [Total Score] FROM Tags JOIN PostTags ON Tags.Id = PostTags.TagId AND Tags.TagName = '##TagName##' JOIN Posts questions ON questions.Id = PostTags.PostId AND questions.CommunityOwnedDate IS NULL JOIN Posts answers ON answers.ParentId = questions.Id AND answers.Score <> 0 AND answers.OwnerUserId IS NOT NULL AND answers.CommunityOwnedDate IS NULL JOIN Users ON answers.OwnerUserId = Users.Id GROUP BY Users.Id ORDER BY CASE Users.Id WHEN ##UserId## THEN 1 ELSE 0 END DESC, [Total Score] DESC