Sure it is possible - something like this (I have left the start and end time as two-separate columns, easy enough to combine into a single string column if you need to)SELECT [Year], [Month], [Day], DATEPART (hour, OrderTime) AS OrderTimeStart, DATEPART (hour, DATEADD(hour,1,OrderTime) ) AS OrderTimeEnd, COUNT(*) AS [Count]FROM YourTableGROUP BY [Year], [Month], [Day], DATEPART (hour, OrderTime), DATEPART (hour, DATEADD(hour,1,OrderTime))ORDER BY [Year], [Month], [Day], DATEPART (hour, OrderTime);