wheels0323
Programmer
Need help rounding to one decimal place from two datetime fields.
So far I have.
That brings back a 7.8. The real value is 7.85.
So if I change the code to two decimal places, it brings back a 7.90.
How can I get it to come back with 7.9 only?
The shiftstarttime, and shiftendtime are datetime values.
So far I have.
Code:
SELECT PERSONNUM,
ROUND(convert(decimal(10,1), datediff(minute, shiftstartdate, shiftenddate) / 65.0), 1)
FROM VP_SCHEDULE
WHERE PERSONNUM = '016902'
AND SHIFTSTARTDATE = '2007-03-27 06:00:00.000'
That brings back a 7.8. The real value is 7.85.
So if I change the code to two decimal places, it brings back a 7.90.
Code:
SELECT PERSONNUM,
ROUND(convert(decimal(10,2), datediff(minute, shiftstartdate, shiftenddate) / 65.0), 1)
FROM VP_SCHEDULE
WHERE PERSONNUM = '016902'
AND SHIFTSTARTDATE = '2007-03-27 06:00:00.000'
How can I get it to come back with 7.9 only?
The shiftstarttime, and shiftendtime are datetime values.