Response rate over day of week


Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

DECLARE @startdate as date, @enddate as date

-- It should be noted that dates should be given with single quote
-- e.g.    '2016-04-22'
SET @startdate = cast(##startdate## as date)
SET @enddate = cast(##enddate?GETDATE()## as date)

      cast(numberOfQuestions AS float) / cast(numberOfQuestionWithAnAnswer AS float) as responseRate
from (
  select DATEPART(dw, CreationDate) as dayId,
         count(*) as numberOfQuestions,
         sum(case when acceptedAnswerId is null then 0 else 1 end) as numberOfQuestionWithAnAnswer
  from Posts
  where PostTypeId=1 and CreationDate between @startdate and @enddate
  group by DATEPART(dw, CreationDate)
) as data

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results