TopX Commented Question

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

-- declare @qid as int = ##Question:int## ;


with CommentedQs as (
    select IsNull(p.parentId, p.Id) as [Id],
        count (*) as [CCount]
    from posts p, Comments c
    where c.PostId = P.Id
    group by IsNull(p.parentId, p.Id)
    )
select TOP ##TopX:int?100##
    Id as [Post Link],
    CCount as [Comment Count]
from CommentedQs
order by CCount desc

Enter Parameters

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