Questions Count by Month

3

Please login or register to vote for this query.

(click on this box to dismiss)

Iota

Q&A for users of Iota, the open-source cryptocurrency for IoT that does not use a blockchain

-- https://www.mssqltips.com/sqlservertip/1145/date-and-time-conversions-using-sql-server/
-- https://www.mssqltips.com/sqlservertip/2655/format-sql-server-dates-with-format-function/
-- '%Y %M %D %H:%i:%s'
-- from_unixtime(d.CreationDate, '%Y %M') as [M]
-- DATE_FORMAT(d.CreationDate, '%d/%m/%Y') as M,  
-- convert(varchar(10), d.CreationDate, 101) as [date1],

SELECT date1, count(id) as cnt
FROM (

  SELECT 
    FORMAT (d.CreationDate, 'yy-MM') as [date1],
    (d.Id) as id
  FROM Posts d  -- d=duplicate
    LEFT JOIN PostHistory ph ON ph.PostId = d.Id
    LEFT JOIN PostLinks pl ON pl.PostId = d.Id
    LEFT JOIN Posts o ON o.Id = pl.RelatedPostId  -- o=original
  WHERE
    d.PostTypeId = 1  -- 1=Question
    AND pl.LinkTypeId = 3  -- 3=duplicate
    AND ph.PostHistoryTypeId = 10  -- 10=Post Closed
    
  ) as t1
group by date1
order by date1

Enter Parameters

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