Posts with lots of comments

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gets the posts with the most comments

Stack Overflow

Q&A for programmers

-- Posts with lots of comments
-- Gets the posts with the most comments

select top 100
    posts.id as [Post Link], count(comments.id) as 'Number of Comments'
from
    posts
inner join
    comments
on
    comments.postid = posts.id
group by
    posts.id
order by
    count(comments.id) desc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached