Skip to content

Turnaround Time SQL Queries

kusum18 edited this page Mar 2, 2013 · 2 revisions
  1. Turn around time by post id
    SELECT
    posts.id,
    unix_timestamp(posts.CreationDate) as ‘Post date’,
    answers.id,unix_timestamp(answers.CreationDate) as ‘Answer date’,
    (unix_timestamp(answers.CreationDate)-unix_timestamp(posts.CreationDate))/60
    FROM
    stackoverflow.posts posts,stackoverflow.posts answers
    where
    posts.AcceptedAnswerId is not null and
    posts.AcceptedAnswerId = answers.id ;

  1. Turn around time by tag
    SELECT
    posts.tag,‘java’,
    avg(unix_timestamp(posts.a_creationDate)-unix_timestamp(posts.CreationDate))
    FROM
    stackoverflow.tag_post_answer_map posts
    where
    tag is not null and tag!="" and
    java=1
    group by tag order by tag;

Clone this wiki locally