Q&A about the site for administrators, end users, developers and designers for Craft CMS
select DATEADD(YEAR, DATEDIFF(YEAR, 0, CreationDate), 0) AS [YEAR] , COUNT(DISTINCT Posts.Id) AS Count from posts where postTypeId = 1 -- AND CreationDate > '2018-01-01' GROUP BY DATEADD(YEAR, DATEDIFF(YEAR, 0, CreationDate), 0) ORDER BY [YEAR] DESC