Time it takes to get an answer per day

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

select [Month], 
avg((DATEPART(hour, fgitw1) * 60 * 60) +
	(DATEPART(minute, fgitw1) * 60) +
    DATEPART(second, fgitw1) ) as FGITW
from
(
  select CAST(cast(DATEPART(YYYY, p.CreationDate) as varchar) + '-' + cast(DATEPART(MM, p.CreationDate) as varchar) +'-'+cast(DATEPART(DD,p.CreationDate) as varchar)+ ' 00:00:00'
    as datetime) [Month], 
    p.id,
    p2.CreationDate-p.Creationdate as fgitw1
    
from Posts p inner join posts p2 on p2.parentid=p.id and p2.id =
(select top 1 p3.id from posts p3 where p3.posttypeid=2 
   and p3.parentid=p.id  order by creationdate asc) 
   
   where p.posttypeid=1 and cast(DATEPART(YYYY, p.CreationDate) as varchar)='2013' and cast(DATEPART(MM, p.CreationDate) as varchar)>3

 
 
 ) as X
group by [Month]
order by [Month] asc

Enter Parameters

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