Question 3

0

Please login or register to vote for this query.

(click on this box to dismiss)

Quantum Computing Meta

Q&A about the site for engineers, scientists, programmers, and computing professionals interested in quantum computing

WITH UserComments AS (
    SELECT 
        C.UserId, 
        COUNT(DISTINCT C.PostId) AS CommentCount
    FROM Comments C
    GROUP BY C.UserId
    HAVING COUNT(DISTINCT C.PostId) >= 10
), 

CorrectAnswers AS (
    SELECT  
        A.OwnerUserId AS UserId
    FROM Posts Q 
    JOIN Posts A ON Q.AcceptedAnswerId = A.Id
    WHERE Q.PostTypeId = 1 
      AND A.PostTypeId = 2
)
SELECT 
    U.Id, U.DisplayName, 
    COUNT(CA.UserId) AS CorrectAnswerCount
FROM Users U
JOIN CorrectAnswers CA ON U.Id = CA.UserId
JOIN UserComments UC ON U.Id = UC.UserId
WHERE U.CreationDate < DATEADD(month, -6, GETDATE())
GROUP BY U.Id, U.DisplayName
ORDER BY CorrectAnswerCount DESC;

Enter Parameters

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