Question/post ratio by post sequence

0

Please login or register to vote for this query.

(click on this box to dismiss)

MathOverflow

Q&A for professional mathematicians

-- http://blog.stackoverflow.com/2010/03/important-reputation-rule-changes/
declare @epoch datetime = '2010-10-19';

with sample_posts as(
select rank () over (partition by OwnerUserId order by CreationDate) sequence, 
       PostTypeId
from PostsWithDeleted
where PostTypeId in (1,2)
--      and CreationDate > @epoch
)

select --count(*) N, 
       sequence,
       sum(case when PostTypeId = 1 then 1.0 end)/count(*) q_ratio
       
from sample_posts
where sequence <= 100
group by sequence
order by sequence

Enter Parameters

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