Number of users that answer 10 or more questions a month

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow Meta en español

Preguntas y respuestas sobre el sitio para programadores y profesionales de la informática

DECLARE @StartTime DATETIME = convert(DATETIME, '##StartTime?2000/01/01 00:00:00##')
DECLARE @EndTime DATETIME = getdate()

select
  MonthOf,
  count(distinct OwnerUserId) as "ActiveAnswerers"
from (select
  MonthOf,
  OwnerUserId,
  count(*) as "Cnt"
from (select
    OwnerUserId,
    dateadd(day, 1-datepart(day, CreationDate), convert(date,CreationDate)) as 'MonthOf'
  from
    Posts q
  where
    q.CreationDate > @StartTime and q.CreationDate < @EndTime
    and q.PostTypeId = 2 -- answers only
    and q.ClosedDate is null -- not closed
) t1
group by
  MonthOf, OwnerUserId
) t2
where
  t2.Cnt >= 2
group by
  MonthOf
order by
  MonthOf desc

Enter Parameters

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