Occurrences of a tag, per date (month, year)

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 
  sub.YMDate, 
  sub.Occurrences 
FROM (
  SELECT DATEPART(Year, CreationDate) Year, DATEPART(Month, CreationDate) Month, 
    CAST(
      CAST(DATEPART(Year, CreationDate) AS varchar) + 
      '-' + 
      CAST(DATEPART(Month, CreationDate) AS varchar) + 
      '-1' AS DATETIME) YMDate, 
     COUNT(Id) [Occurrences]
  FROM 
    Posts 
  WHERE 
    PostTypeId = 1 
    AND Tags LIKE '%' + ##tag:string?math## + '%'
  GROUP BY 
    DATEPART(Year, CreationDate), DATEPART(Month, CreationDate)
   ) sub
ORDER BY
  sub.YMDate

Enter Parameters

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