Wednesday, 14 August 2013

SQL Datetime as time query

SQL Datetime as time query

I would like the below select statement to be show as time rather than
datetime. I'm aware that a cast as solution is likely however given I am
trying to Cast as a "grouped by time", I am not finding a solution.
SELECT
DATEADD(hour, DATEDIFF(hour, 0,dbo.tbReceiptLine.Time), 0) AS Hourly,
DATEADD(minute, DATEDIFF(minute, 0, dbo.tbReceiptLine.Time) / 30 * 30, 0)
AS [30 Mins]
I would like to show this as time only.
Help please?

No comments:

Post a Comment