SELECT COUNT(*) FROM Users u WHERE u.Id IN (SELECT OwnerU...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT COUNT(*)
FROM Users u
-- all users who posted
WHERE u.Id IN (SELECT OwnerUserId FROM Posts p 
               WHERE PostTypeId IN (1, 2) 
               AND p.CreationDate > DATEADD(month, -1, GETUTCDATE()))
-- or commented
OR u.Id IN (SELECT UserId FROM Comments c
            WHERE c.CreationDate > DATEADD(month, -1, GETUTCDATE()))
-- or edited
OR u.Id IN (SELECT UserId FROM PostHistory ph
            WHERE ph.PostHistoryTypeId IN (4,5,6)
            AND ph.CreationDate > DATEADD(month, -1, GETUTCDATE()))

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results