Tag frequency by Time of Day and Day of Week

0

Please login or register to vote for this query.

(click on this box to dismiss)

Give me a tag, I'll show you when it is most likely to be answered... sort of.

Mathematics

Q&A for people studying math at any level and professionals in related fields

-- Tag/Answer frequency by Time of Day and Day of Week 
-- Also used query 63782 on Tag over Time
-- Designed to consider whether "night" questions have more visibility than "day" questions 
DECLARE @TagName NVarChar(50) = '##TagName##'

SELECT weekdaynum, 
       daytimename, 
       COUNT(*) questions 
FROM   (SELECT Datepart(weekday, ans.creationdate) AS weekdaynum, 
               Datepart(HOUR, ans.creationdate) AS daytimenum,
               CASE Round(Datepart(HOUR, ans.creationdate)/4, 1) 
                 WHEN 0 THEN 'early morning' 
                 WHEN 1 THEN 'morning' 
                 WHEN 2 THEN 'late morning' 
                 WHEN 3 THEN 'afternoon' 
                 WHEN 4 THEN 'late afternoon' 
                 WHEN 5 THEN 'evening' 
               END                                   AS daytimename
        FROM   posts p, posts ans
        WHERE  ans.parentid = p.id 
        AND p.tags LIKE '%<' + @TagName+'>%'
       ) AS X
GROUP  BY weekdaynum, daytimename
ORDER  BY questions

Enter Parameters

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