DECLARE @StartDate DATE = '2009-01-01'; DECLARE @EndDate ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Anime and Manga

Q&A for anime and manga fans

DECLARE @StartDate DATE = '2009-01-01';
DECLARE @EndDate DATE = '2023-12-31';

WITH Tagged AS (
  SELECT
    Id,
    CreationDate,
    CASE WHEN CHARINDEX('<java>', Tags) > 0 THEN 1 ELSE 0 END AS JavaTag,
    CASE WHEN CHARINDEX('<javascript>', Tags) > 0 THEN 1 ELSE 0 END AS JavascriptTag,
    CASE WHEN CHARINDEX('<typescript>', Tags) > 0 THEN 1 ELSE 0 END AS TypeScriptTag

  FROM PostsWithDeleted
  WHERE
    PostTypeId = 1 AND -- 1 for 
    CreationDate >= @StartDate AND
    CreationDate <= @EndDate
),
MonthlyCounts AS (
  SELECT
    DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS Month,
    SUM(JavaTag) AS Java,
    SUM(JavascriptTag) AS Javascript,
    SUM(TypeScriptTag) AS TypeScript
  FROM Tagged
  GROUP BY DATEADD(month, DATEDIFF(month, 0, CreationDate), 0)
)
SELECT
  Month,
  Java,
  Javascript,
  TypeScript
FROM MonthlyCounts
ORDER BY Month;

Enter Parameters

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