Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

returning a decimal value from an epression

Status
Not open for further replies.

deharris2003

Programmer
Jul 1, 2003
41
US
OK i am still new at SQL and my probelm is that when I divide Minutes by 60 (I.E. 458 minutes divided by 60 should return 7.63 hours) However When I do SUM(MINS)/60 I get 7. I tried CAST((SUM(MINS) / 60) as float) As hours and I still get 7. Can anyone tell me how to get SQL to return 7.63 instead of 7?
 
IS minutes an integer datatype? YOu need to cast or convert just the minutes part of the equation first. An integer divided by anything will always give you an integer result.

CONVERT(DECIMAL(18,2),(SUM(MINS))/60.00
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top