General discussion


Grouping dates into days

By bop_zw ·
I am trying to group a date Range result set of say one month into days between 22:00:00 and 21:59:59. I's this possible with SQL or do I have to do it in my .NET application?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

wrong forum

by john.a.wills In reply to Grouping dates into days

try Technical Q & A

Collapse -

Depends on the dbms

by Tony Hopkinson In reply to Grouping dates into days

but the easy way is something like
Select DatePart('day',DateAdd(2, hour,mydatefield)) From My Table
Where MyDateField >= ... 22:00 and MyDateField <= ....21:59.
whatever the exact syntax add two hours to get to the date boundary and then select the day of the month from that.

Related Discussions

Related Forums