3-per-week-askers/answers 2016-01-01 to 2022-11-30

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping

Q&A for gardeners and landscapers

DECLARE @refdate DATETIME = DATEFROMPARTS(2008,1,1);
SELECT
  DATEADD(week, MIN(C.WeekNumber), @refdate) AS WeekNumber,
  CASE WHEN C.PostTypeId = 1 THEN 'asking' ELSE 'answering' END AS Type,
  COUNT(*) AS UserCount
FROM (
SELECT
  DATEDIFF(week, @refdate, P.CreationDate) AS WeekNumber,
  P.PostTypeId
  --MAX(P.OwnerUserId) AS UserId
FROM Posts P
WHERE P.CreationDate >= @refdate
  AND P.CreationDate < DATEFROMPARTS(2024,4,1)
  AND P.PostTypeId IN (1,2)
GROUP BY
  P.PostTypeId,
  P.OwnerUserId,
  DATEDIFF(week, @refdate, P.CreationDate)
HAVING COUNT(*) >= 1
) C
GROUP BY WeekNumber, C.PostTypeId
ORDER BY Type, WeekNumber ASC

Enter Parameters

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