Skip to content

Instantly share code, notes, and snippets.

@chewxy
Created October 31, 2012 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chewxy/3987364 to your computer and use it in GitHub Desktop.
Save chewxy/3987364 to your computer and use it in GitHub Desktop.
Used to query StackOverflow's data explorer. Originally written by Guillermo Winkler. Adapted by me
SELECT
Questions.CreationDate,
Questions.Title,
Tags.TagName,
Answers.CreationDate as ResponseDate,
datediff(minute, Questions.CreationDate,
Answers.CreationDate) as ResponseTime,
cast(DATEPART(hour, Questions.CreationDate) as int) as ResponseHour
FROM Posts Questions
join Posts Answers on Answers.id = Questions.AcceptedAnswerId
and datediff(hour, Questions.CreationDate, Answers.CreationDate) < 5
join PostTags ON PostTags.PostId = Questions.Id
join Tags on Tags.Id = PostTags.TagId
WHERE Questions.CreationDate > convert(datetime, '01/01/2012', 101)
and TagName in ('c#', 'java', 'php', 'javascript', 'c++', 'python', 'objective-c', 'c', 'ruby', 'vb.net')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment