Number of users answering or questioning.

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT
        DATEPART(yyyy, CreationDate) as Year,
        DATEPART(q, CreationDate) as Quarter,
        COUNT(DISTINCT CASE when PostTypeId = 1 then OwnerUserId else null END) as Questioning,
        COUNT(DISTINCT CASE when PostTypeId = 2 then OwnerUserId else null end) as Answering
    FROM Posts
    GROUP BY DATEPART(yyyy, CreationDate)
           , DATEPART(q, CreationDate)
    ORDER BY DATEPART(yyyy, CreationDate)
           , DATEPART(q, CreationDate)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached