Question 2 Response

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

select top 10 u.id as [User Link], (count(p.id) + count(c.id)) as Total_Posts_Comments
from posts p
left join comments c on c.postid = p.id
left join users u on u.id = p.owneruserid
where (datediff(year, current_timestamp, p.creationdate) >= -5
or datediff(year, current_timestamp, c.creationdate) >= -5)
group by u.id
order by Total_Posts_Comments desc

Enter Parameters

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