Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
berinder
Starting Member
18 Posts |
Posted - 2001-05-31 : 06:07:39
|
Hello Forum,I'm doing a report and need a "group by hour", the time is in a datetime-field and i just can't find how to do it. |
|
hungyen36
Starting Member
1 Post |
Posted - 2011-08-25 : 12:34:01
|
GROUP BY CAST(YourTimestampColumn AS Date), datepart(hh, YourTimestampColumn) |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2011-08-25 : 16:34:49
|
If you want to group by the date and time, rounded down to the nearest hour:GROUP BY dateadd(hour, datediff(hour, 0, {your date column}, 0)Jeff |
|
|
|
|
|