Minimum, Maximum, and Average Number of Answers Per Post

0

Please login or register to vote for this query.

(click on this box to dismiss)

The minimum, maximum, and average number of answers per post on Stack Overflow.

Emacs

Q&A for those using, extending or developing Emacs

---Counts votes for answers done before and after a badge with offset
declare @offset int = 0
declare @start datetime = '2013/1/1'
declare @end datetime = '2013/2/1'

--Title "AfterBadgeOffsetX"
  select  
    u.Id,
    (select score
     from Posts 
     where posttypeid=2 
     and CreationDate >= b.Date
     and OwnerUserId= u.Id 
      order by CreationDate asc
     offset @offset+1 ROWS fetch next 1 row only) as [SAnswer Score]
    from Badges as b
    inner join Users as u
    on b.UserId = u.Id
    
    where 
    b.Name = 'Nice Answer' and
     u.CreationDate >= @start and
    u.CreationDate < @end
    order by u.CreationDate desc

Enter Parameters

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