Top 20 answers in decending order of score

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @UserId int = ##UserId##
SELECT
  answ.Id "AnswerID",
  q.Id "QuestionID",
  answ.Body "AnswerBody",
  q.Body "QuestionBody",
  answ.Score "AnswerScore",
  q.Score "QuestionScore",
  answ.CreationDate "AnswerDate",
  q.CreationDate "QuestionDate"
FROM 
  Posts answ JOIN Posts q on q.Id = answ.ParentId 
WHERE
  answ.PostTypeID =  2 AND answ.OwnerUserId = @UserID
ORDER BY answ.Score DESC

Enter Parameters

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