• subramaniam.chandrasekar - Thursday, February 15, 2018 6:36 AM

    TheSQLGuru - Wednesday, February 14, 2018 3:00 PM

    In the meantime, checkout DATEPART in books online. That and GROUP BY will be in your solution I think.

    Can't we use normal conventional Group by here ?

    I see no mention of using an unconventional GROUP BY, so I don't understand the reason for your comment.

    If the underlying date data types contain time information – and we must assume that they do, based on the requirement – then DATEPART can be used to break these datetimes out into hourly blocks, before grouping them.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.