Answers per user per day, by period of account creation

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- StartDate: User create start date (YYYY-MM-DD)
-- EndDate: User create end date (YYYY-MM-DD)
with yearUsers as (
    select id 
    from Users u
    where u.CreationDate >= ##StartDate:string## and u.CreationDate < ##EndDate:string##
)
select 
CAST(count(1) as float) / (select count(1) from yearUsers) / datediff(DAY, ##StartDate:string##, getDate()) 
from yearUsers u
inner join Posts p on p.OwnerUserId = u.Id
and p.PostTypeId = 2 -- answer

Enter Parameters

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