My top 10 Posts with highest score for Comments

2

Please login or register to vote for this query.

(click on this box to dismiss)

My top 10 Posts with highest score for Comments

Stack Overflow

Q&A for professional and enthusiast programmers

-- My top 10 Posts with highest score for Comments
-- My top 10 Posts with highest score for Comments

DECLARE @UserId int = ##UserId##
SELECT TOP 10 
  a.Score, 
  a.PostId as [Post Link]  
FROM
  (SELECT *, row_number() over(partition BY PostId
                               ORDER BY Score) cn
   FROM Comments
   WHERE UserId = @UserId )a
WHERE cn = 1 
ORDER BY score DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results