DECLARE @PostId int = ##PostId## SELECT DATEFROMPARTS(YE...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Materials Modeling Meta

Q&A for materials modelers and data scientists

DECLARE @PostId int = ##PostId##

SELECT
    DATEFROMPARTS(YEAR(creationdate), MONTH(creationdate), 1) AS [Year-Month],
    COUNT(CASE WHEN posthistorytypeid > 0 THEN 1 ELSE NULL END) AS [Activity]
    
FROM posthistory

WHERE postid in (SELECT id from posts 
                  where id = @postid 
                  or parentid = @postid )
    AND creationdate < '2021-11-01 00:00:00'
    --AND (creationdate >= '##Date1?2016-07-01##') AND (creationdate <= '##Date2?2021-11-01##')

GROUP BY DATEFROMPARTS(YEAR(creationdate), MONTH(creationdate), 1)

ORDER BY DATEFROMPARTS(YEAR(creationdate), MONTH(creationdate), 1) ASC

Enter Parameters

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