mybusiness-MedianViewsPerQuestion

0

Please login or register to vote for this query.

(click on this box to dismiss)

Japanese Language Meta

Q&A about the site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language

DECLARE @StartDate datetime = '2022-06-20';
DECLARE @EndDate datetime = '2022-10-19';

WITH QuestionViews AS (
    SELECT 
        ViewCount,
        ROW_NUMBER() OVER (ORDER BY ViewCount) AS RowNum,
        COUNT(*) OVER () AS TotalRows
    FROM 
        Posts
    WHERE 
        PostTypeId = 1 -- 1 represents questions
        AND CreationDate BETWEEN @StartDate AND @EndDate
)
SELECT 
    AVG(ViewCount * 1.0) AS MedianViews
FROM 
    QuestionViews
WHERE 
    RowNum IN ((TotalRows + 1) / 2, (TotalRows + 2) / 2);

Enter Parameters

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