I am using SQL 2008. I have following table.
HostName | Timestamp | ErrorType |
Server 1 | 2014-03-11 00:10:39.387 | N/W Error |
Server 2 | 2014-03-11 01:10:40.387 | DB Error |
Server 1 | 2014-03-11 00:20:39.387 | N/W Error |
Server 2 | 2014-03-11 02:10:40.387 | N/W Error |
Server 2 | 2014-03-11 02:00:39.387 | N/W Error |
Server 1 | 2014-03-11 03:30:39.387 | N/W Error |
Server 1 | 2014-03-11 03:45:39.387 | N/W Error |
Server 1 | 2014-03-12 13:45:39.387 | N/W Error |
Server 2 | 2014-03-12 14:45:39.387 | DB Error |
I would like to get how many errors occur per hour per server in a particular day. . So basically I will just pass date (such as 2014-03-11) in my query and it will be below report.
But I am not sure how to get it. Any help would be appreciated
HostName | NumberofError | Time | Errortype |
Server 1 | 2 | 12 AM | N/W Error |
Server 2 | 1 | 1 AM | DB Error |
Server 2 | 2 | 2 AM | N/W Error |
Server 1 | 2 | 3 AM | N/W Error |
Thanks