Submit hour of Questions and Answers

1

Please login or register to vote for this query.

(click on this box to dismiss)

How many questions and answers at various hours in the day? Switch to graph view to see what times are the most popular for submitting content to the site. (All times are GMT). Use "minDate" and "maxDate" to filter down the posts to a certain time frame.

Stack Overflow

Q&A for professional and enthusiast programmers

;with PostTimes as
(
  select 
    p.Id,
    datepart(hh, p.CreationDate) [HourPosted],
    p.PostTypeId
  from Posts p
  where p.CreationDate between ##minDate:string?2005-01-01##
                      and ##maxDate:string?2020-01-01##
),
QuestionTimes as
(
  select
    pt.HourPosted,
    count(pt.HourPosted) [QuestionCount]
  from PostTimes pt
  where pt.PostTypeId = 1 --question
  group by pt.HourPosted
),
AnswerTimes as
(
  select
    pt.HourPosted,
    count(pt.HourPosted) [AnswerCount]
  from PostTimes pt
  where pt.PostTypeId = 2 --answer
  group by pt.HourPosted
)
select
  qt.HourPosted,
  qt.QuestionCount,
  at.AnswerCount
from 
QuestionTimes qt
inner join AnswerTimes at on qt.HourPosted = at.HourPosted
order by qt.HourPosted asc

Enter Parameters

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