3. Provide a leaderboard of users with correct answers who have commented on at least 10 unique post

0

Please login or register to vote for this query.

(click on this box to dismiss)

Skeptics

Q&A for scientific skepticism

SELECT TOP 10
U.Id,
U.CreationDate, 
C.Score, 
COUNT(DISTINCT C.PostId) AS Num_Comments
FROM Users U
LEFT JOIN Comments C
ON C.UserId = U.Id
WHERE U.CreationDate <= DATEADD(MONTH,-6,GETDATE())
GROUP BY U.Id, U.CreationDate, C.Score
HAVING COUNT(DISTINCT C.PostId)> 10

Enter Parameters

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