Show the hours of the day a user is most active

1

Please login or register to vote for this query.

(click on this box to dismiss)

Gets the hours in which a user has been active (enables you to see when a user sleeps!)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Show the hours of the day a user is most active
-- Gets the hours in which a user has been active (enables you to see when a user sleeps!)

with hours as 
(
select datepart(hh, creationdate) as HoursSeen from posts where owneruserid = ##UserId##
union all
select datepart(hh, creationdate) as HoursSeen from comments where userid = ##UserId##
)

select HoursSeen as Hour, count(*) as Count, '|' + replicate('*', count(*)) as Graph  from hours
group by HoursSeen
order by HoursSeen

Enter Parameters

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