Answer times

1

Please login or register to vote for this query.

(click on this box to dismiss)

Engineering

Q&A for professionals and students of engineering

SELECT top 50
  tagName.tagName as 'tag name',
  count(*) as 'number of accepted answers',
  cast(avg(datediff(day, question.CreationDate, answer.CreationDate)) as char(8)) + 'days, ' +
  cast(avg(datediff(hour, question.CreationDate, answer.CreationDate))%24 as char(8)) + 'hours, ' +
  cast(avg(datediff(minute, question.CreationDate, answer.CreationDate))%60 as char(8)) + 'minutes, ' +
  cast(avg(datediff(second, question.CreationDate, answer.CreationDate))%60 as char(8)) + 'seconds' as 'average time',
  cast(min(datediff(day, question.CreationDate, answer.CreationDate)) as char(8)) + 'days, ' +
  cast(min(datediff(hour, question.CreationDate, answer.CreationDate))%24 as char(8)) + 'hours, ' +
  cast(min(datediff(minute, question.CreationDate, answer.CreationDate))%60 as char(8)) + 'minutes, ' +
  cast(min(datediff(second, question.CreationDate, answer.CreationDate))%60 as char(8)) + 'seconds' as 'min time',
  cast(max(datediff(day, question.CreationDate, answer.CreationDate)) as char(8)) + 'days, ' +
  cast(max(datediff(hour, question.CreationDate, answer.CreationDate))%24 as char(8)) + 'hours, ' +
  cast(max(datediff(minute, question.CreationDate, answer.CreationDate))%60 as char(8)) + 'minutes, ' +
  cast(max(datediff(second, question.CreationDate, answer.CreationDate))%60 as char(8)) + 'seconds' as 'max time'
FROM 
    posts as question
  inner join
    posts as answer
    on
      question.acceptedAnswerID = answer.id
  inner join 
    postTags as tag
    on 
      question.id = tag.postID
  inner join 
    tags as tagname
    on
      tag.tagID = tagname.id
GROUP BY 
--  tag.tagID
  tagname.tagName
HAVING 
  count(*) >= 10
  and tagname.tagname like '##tagname##'
ORDER BY 
  avg(datediff(second, question.CreationDate, answer.CreationDate)) ASC

Enter Parameters

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