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)

Network Engineering

Q&A for network engineers

select users.id, count(users.no_of_comments) as comments,cast(c.creationdate as date)
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
where cast(c.creationdate as date) = '2020-01-02 00:00:00'
group by users.id,cast(c.creationdate as date)

Enter Parameters

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