Q3

0

Please login or register to vote for this query.

(click on this box to dismiss)

Tor Meta

Q&A about the site for researchers, developers, and users of Tor

SELECT 
    u.Id AS UserId,
    u.DisplayName,
    u.Reputation,
    COUNT(DISTINCT c.PostId) AS UniqueCommentedPosts,
    COUNT(DISTINCT CASE WHEN p.PostTypeId = 2 AND p.Id = p.AcceptedAnswerId THEN p.Id END) AS CorrectAnswers
FROM 
    Users u
LEFT JOIN 
    Posts p ON u.Id = p.OwnerUserId
LEFT JOIN 
    Comments c ON u.Id = c.UserId
WHERE 
    u.CreationDate <= DATEADD(month, -6, GETDATE())
GROUP BY 
    u.Id, u.DisplayName, u.Reputation
HAVING 
    COUNT(DISTINCT c.PostId) >= 10
ORDER BY 
    CorrectAnswers DESC;

Enter Parameters

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