TEST

0

Please login or register to vote for this query.

(click on this box to dismiss)

Moderators

Q&A for community managers, administrators, and moderators

-- Declare Variables
DECLARE @user_id   INT = 1366033;
DECLARE @tag_id    INT = (SELECT Id FROM Tags WHERE TagName = 'twitter-bootstrap');
DECLARE @answer_id 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_id
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