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!)

Lifehacks Meta

Q&A about the site for people looking to bypass life's everyday problems with simple tricks

-- 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 main site
loading Hold tight while we fetch your results