2. Provide a list of the top 10 users who made the most posts and comments over the past 5 years.

0

Please login or register to vote for this query.

(click on this box to dismiss)

IT Security Meta

Q&A about the site for information security professionals

SELECT Top 10
P.OwnerUserId,
COUNT(P.Id) AS Num_Posts,
COUNT(C.Id) AS Num_Comments
FROM Posts P
LEFT JOIN Comments C
ON C.UserId = P.OwneruserId
WHERE P.CreationDate > DATEADD(YEAR,-5,GETDATE())
GROUP BY P.OwnerUserId

Enter Parameters

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