Count of posts where more than 10 comments

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT COUNT(id) FROM 
(
SELECT p.id, 
       Count(*) AS CommentCount 
FROM   posts p 
       INNER JOIN comments c 
               ON c.postid = p.id 
GROUP  BY p.id, 
          p.title, 
          p.creationdate, 
          commentcount 
HAVING commentcount > 10 
) as t

Enter Parameters

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