User post activity history by year of registration

1

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

WITH Raw AS (
  SELECT
    DATEFROMPARTS(
      DATEPART(yyyy, Posts.CreationDate),
      DATEPART(m, Posts.CreationDate),
      1) AS PostMonth,
    DATEPART(yyyy, Users.CreationDate) AS UserYear,
    COUNT(*) AS Count
  FROM Posts, Users
  WHERE
    Posts.OwnerUserId = Users.Id
    AND
    Users.Id > 0
  GROUP BY
    DATEFROMPARTS(
      DATEPART(yyyy, Posts.CreationDate),
      DATEPART(m, Posts.CreationDate),
      1),
    DATEPART(yyyy, Users.CreationDate)
)
SELECT PostMonth, CAST(UserYear AS VARCHAR(MAX)), Count
FROM Raw
ORDER BY PostMonth, UserYear

Enter Parameters

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