heatmap in a single select or stored procedure
I have a table of server requests - each with a timestamp. What I would
like to accomplish is that the result of my query (or preferably a stored
procedure) gives me, for a single day, a table with each hour of the day
across the top (from 0 to 23) and each minute of the hour down the side
(from 0 to 59). The intersecting data would display the count of requests
per minute, per hour.
What I have tried so far is group the minutes by hour of the day, and
manipulate that in excel to produce the 24x60 matrix using:
SELECT DatePart(HH,Timestamp) as [Hour]
, DatePart(MI,Timestamp) as [Minute]
, Count(*) as [Count]
FROM Requests
WHERE DatePart(Day,Timestamp) = 12
GROUP BY DatePart(HH,Timestamp),
DatePart(MI,Timestamp)
ORDER BY DatePart(HH,Timestamp)
, DatePart(MI,Timestamp)
Any help would be greatly appreciated, thanks in advance for your time :)
No comments:
Post a Comment