select top 10 Users.DisplayName, BestCommentId = BestComm...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Chess

Q&A for serious players and enthusiasts of chess

select top 10 Users.DisplayName,
              BestCommentId = BestComment.Id, BestCommentScore = BestComment.Score,
              WorstCommentId = WorstComment.Id, WorstCommentScore = WorstComment.Score
from Users
  join (select top 1 Comments.Id, Comments.Score, Comments.UserId
        from Comments
        order by Comments.Score) BestComment
    on BestComment.UserId = Users.Id
  join  (select top 1 Comments.Id, Comments.Score, Comments.UserId
        from Comments
        order by Comments.Score desc) WorstComment
    on WorstComment.UserId = Users.Id

Enter Parameters

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