I have a table in SQL Server Management that contains error counts by hours. The table uses has four main columns Errors, StartTime, EndTime and Count. Is there a way I can select the top 1 error or top 5 errors that occur every hour?
A typical entry would look something like this:
| Error | StartTime | EndTime | Count |
|---|---|---|---|
| error 1 | 2022-06-27 00:00:00 | 2022-06-27 01:00:00 | 8 |
| error 2 | 2022-06-27 00:00:00 | 2022-06-27 01:00:00 | 9 |
| error 1 | 2022-06-27 01:00:00 | 2022-06-27 02:00:00 | 1 |
| error 3 | 2022-06-27 01:00:00 | 2022-06-27 02:00:00 | 19 |
For example, in this case, error 2 would be the top error between hours 0 and 1, and error 3 would be the top error between hours 1 and 2.