When to ask questions

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select dateadd(hh,  dow * 24 + hour, convert(datetime,'2021-06-26')) [dow]
     , sum(answercount) / convert(decimal,count(*))  [average number of answers per question]
     , sum(accept) / convert(decimal,count(*)) [percentage of questions with accepted answers] 
     , sum(answered) / convert(decimal,count(*)) [percentage of questions with answers] 
    -- , log10(count(*)) [#q]
from (
select datepart(dw, creationdate) [dow]
     , datepart(hh, creationdate) [hour]
     , datepart(mi, creationdate) [minute]
     , answercount
     , case when acceptedanswerid is not null then 1 else 0 end accept
     , case when answercount > 0 then 1 else 0 end answered
from posts
where posttypeid = 1
) data
group by dow * 24 + hour
order by 1 

select datepart(dw, getdate())

Enter Parameters

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