Threads with the largest number of comments

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace

Q&A for members of the workforce navigating the professional setting

SELECT TOP 100
  IsNull(p.ParentId, p.Id) AS [Post Link],
  Sum(p.CommentCount) AS [#Comments],
  Max(CASE p.PostTypeId WHEN 1 THEN p.CommentCount ELSE 0 END) AS [#Q com],
  Max(p.AnswerCount) AS [#Ans],
  Max(p.ViewCount) AS [Views],
  Max(CASE p.PostTypeId WHEN 1 THEN p.Score ELSE -32767 END) AS [Q score],
  Sum(p.Score) AS [Total score],
  Min(p.CreationDate) AS [Q date]
FROM Posts p
GROUP BY IsNull(p.ParentId, p.Id)
ORDER BY [#Comments] DESC

Enter Parameters

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