Link to home
Start Free TrialLog in
Avatar of Jedidia
JedidiaFlag for United States of America

asked on

T-SQL and Rounding

I have the following t-sql...

SUM(DATEDIFF(MINUTE, CONVERT(datetime, tblProduction.startDate, 101) + ' ' + CONVERT(datetime, tblstarttime.time, 108), CONVERT(datetime, tblProduction.endDate, 101) + ' ' +
CONVERT(datetime, tblendtime.time, 108)) / 60) AS totalhours

It calculates the correct # of minutes, but when I /60 to get the hours, it rounds down.

How should I update this so when 30 minutes is calculated, I get 0.5 hours etc.

ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial