Tuesday, 2 October 2012

TSQL grouping by hour

Dan's post from 2010 helped create an efficient way of converting a column to it's "top-of-the-hour" equivalent, useful for grouping by hour.

SELECT CONVERT(CHAR(13),SourceDateTime,20) + ':00:00' AS NewDateTime

No comments:

Post a Comment