What Rank is Kyle on Twitter-Bootstrap?

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

DECLARE @user_id INT = 1366033;
DECLARE @tag_id  INT = (SELECT ID FROM Tags WHERE TagName = 'twitter-bootstrap');
DECLARE @answer  INT = (SELECT ID FROM PostTypes WHERE Name = 'Answer');

SELECT TOP 25
  RANK() OVER (ORDER BY SUM(a.Score) DESC) AS Rank,
  u.ID AS [User Link],
  SUM(a.Score) AS Score,
  CASE WHEN u.ID = @user_id THEN '<--' ELSE '' END
FROM users u
JOIN Posts a ON u.ID = a.OwnerUserId AND a.PostTypeID = @answer
JOIN Posts p ON a.ParentID = p.ID
JOIN PostTags t ON p.ID = t.PostId AND t.TagID = @tag_id
GROUP BY u.ID
ORDER BY SUM(a.Score) DESC

Enter Parameters

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