User Activity by UTC Hour

0

Please login or register to vote for this query.

(click on this box to dismiss)

What time of day do I post questions and answers most?

elementary OS Meta

Q&A about the site for developers and users of elementary OS and applications

-- My Activity by UTC Hour
-- What time of day do I post questions and answers most?

DECLARE @UserID INT = ##UserID?9449426##

-- Create a table containing all the hours in a day (0-24)
SELECT  x.number AS Hours
INTO    #Hours
FROM    master.dbo.spt_values x
WHERE   x.type = 'P'        
AND     x.number <= 23;

SELECT
  Hours,
  COALESCE(count(CASE WHEN PostTypeId = 1 THEN 3432 END), 0) AS Questions,
  COALESCE(count(CASE WHEN PostTypeId = 2 THEN 1 END), 0) AS Answers
FROM #Hours h
LEFT JOIN Posts ON h.Hours = datepart(hour, CreationDate)
WHERE
  PostTypeId IN (1, 2) AND
  OwnerUserId = @UserID
GROUP BY Hours
ORDER BY Hours

Enter Parameters

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