Average score of a first question (per month)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

;with firstpostids_cte as (
SELECT MIN(Id) AS MinId, OwnerUserId
FROM PostsWithDeleted
WHERE PostTypeId=1
GROUP BY OwnerUserId
)
, firstpostsclosed_cte as (
SELECT
p.Id, p.CreationDate AS cre, p.Score AS sco
FROM firstpostids_cte fp JOIN PostsWithDeleted p ON fp.MinId=p.Id
)

SELECT 
number = ROW_NUMBER() OVER (ORDER BY format(cre, 'yyyy-MM')),
format(cre, 'yyyy-MM'), AVG(cast(sco as decimal))
FROM firstpostsclosed_cte
GROUP BY format(cre, 'yyyy-MM')
ORDER BY format(cre, 'yyyy-MM')

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results