Q&A about the site for administrators, end users, developers and designers for Craft CMS
DECLARE @StartDate datetime = '2022-06-20'; DECLARE @EndDate datetime = '2022-10-19'; SELECT COUNT(*) AS TotalAnswersForPeriod FROM Posts AS p WHERE p.PostTypeId = 2 -- 2 represents answers AND p.ParentId IN ( SELECT q.Id FROM Posts AS q WHERE q.PostTypeId = 1 -- 1 represents questions AND q.CreationDate BETWEEN @StartDate AND @EndDate );