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!

Comparing Decimal Result of Divided Integers 1

Status
Not open for further replies.

fjwolz19

IS-IT--Management
Jul 23, 2008
1
US
I have three fields, which are stored as Integers. field1 is the number of computers in use. field2 is the number os computers out of order. field3 is the total computers at that point in time. I am attempting to determine when the usage is above 90%. I have tried....

SELECT * FROM table
WHERE ((field1 + field2) / field3) > .90

and many, many different variations of this. (I have been working on this for two days now and asking for help is my last resort)

The only results I get back are those in which ((field1 + field2) / field3) = 1. I do not get back any results in which it is below 1, but above .90, which through research I have determined is because I am dividing integers and comparing them to a decimal, but the result of the formula with the integers drops the decimal part. Is there any way to make this work, other than changing the datatype?

Much thanks in advance for any assistance anyone can give me.
 
Another way is to use the CAST operator.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top