Reputation: 111
I can easily use the datediff function to get the results between 2 date and time values as number of hours but how do I put this into a new column beside the second date/time column with a custom name along the lines of HoursTrained?
Thanks!
Upvotes: 0
Views: 6255
Reputation: 79969
If I don't miss something, then I thik you are looking for something like:
Select DateFrom, DateTo,
DateDiff(day, DateFrom, DateTo) as 'Difference in Days',
DateDiff(hour,DateFrom, DateTo) as 'Difference in Hours'
From TableName
Upvotes: 2