select top 30 Users.DisplayName, BestComment.Id, Max(Best...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Amateur Radio

Q&A for amateur radio enthusiasts

select top 30 Users.DisplayName,
              BestComment.Id, Max(BestComment.Score),
              WorstComment.Id, Max(WorstComment.Score)
from Users
  join (select top 50000 Comments.Id, Comments.Score, Comments.UserId
        from Comments
        order by Comments.Score desc) BestComment
    on BestComment.UserId = Users.Id
  join (select top 50000 Comments.Id, Comments.Score, Comments.UserId
        from Comments
        order by Comments.Score) WorstComment
    on WorstComment.UserId = Users.Id
  where BestComment.Score>0
    and WorstComment.Score<=0
group by Users.DisplayName, BestComment.Id, WorstComment.Id

Enter Parameters

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