mybusiness-TotalAnswersForPeriod

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

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
    );

Enter Parameters

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