select users.id, count(users.no_of_comments) as comments ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow Meta en español

Preguntas y respuestas sobre el sitio para programadores y profesionales de la informática

select users.id, count(users.no_of_comments) as comments
from
(select top 50 p.id, p.commentcount as no_of_comments
from posts p
where year(p.CreationDate) = year(getdate())-1
group by p.id,p.commentcount
order by no_of_comments desc) as users
inner join comments c on users.id = c.postid
group by users.id

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results