Posters/Commenters/Editors Last Month

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

WITH LastMonthsPosters AS (
  SELECT OwnerUserId UserId FROM Posts p 
  WHERE PostTypeId IN (1, 2) 
  AND p.CreationDate > DATEADD(month, -1, GETUTCDATE())
),
LastMonthsCommenters AS (
  SELECT UserId FROM Comments c
  WHERE c.CreationDate > DATEADD(month, -1, GETUTCDATE())
),
LastMonthsEditors AS (
  SELECT UserId FROM PostHistory ph
  WHERE ph.PostHistoryTypeId IN (4,5,6)
  AND ph.CreationDate > DATEADD(month, -1, GETUTCDATE())
)
SELECT COUNT(*)
FROM Users u
WHERE u.Id IN (SELECT UserId FROM LastMonthsPosters)
OR u.Id IN (SELECT UserId FROM LastMonthsCommenters)
OR u.Id IN (SELECT UserId FROM LastMonthsEditors)

Enter Parameters

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