|
Well I think this may work for getting the height into inches (this is based upon mysql hopefully it works in other sql). I don't know much about sql besides administering databases online but I found this in one of hte books I have.
The modulo operator; evaluates to the remainder of m divided by m % n is the same as MOD(m,n).. As with division, the modulo operator with a divisor of zero returns NULL.
Here is a quote from Sam's MySQL
"The modulo operator; evaluates to the remainder of m dived by m % n is the same as MOD(m,n). As with division, the modulo operator with a divisor of zero returns NULL."
So therefore I think you can do the following
Multiply cm x .39 then divid by 12 and strip anything to the right of the decimal point if one is returned. If you dont have any decimals then it is obviously a nice round number divisible by .39 which is very unlikely. When you do have something that is stripped then you have to take the original number you got after doing the first operation and then use the % to get the remainder which you add on to the original cmx.39 result stripped of the decimals.
c=cm
(cmx.39)/12=a
a (rounded down, stripped of decimals whatever you want to call it or use to get a round number) is the number of feet.
a%12=r
R is the remainder and is the inches number. So therefore you can display as fllows
A feet r inches and then make sure that you put somethign in there so that it does not show anythign for the inches if the remainder comes back as 0 and so that it says inch rather than inches if it is 1.
Some modification will be needed as .39 is NOT an exact conversion factor so you may get a little error and you WILL need to round the inches using whatever method you choose so that you can get what you need, I'd say just round to the nearest whole number .
I hope this helps but as I don't really understand too much of any type of sql and this is from a mysql book I'm not sure it will help but I hope you find it useful and it helps you figure out your conundrum.
FIXED!
__________________
It's called baseball not foosball!
Last edited by YoVivoPorSPORTS; 09-07-2006 at 01:08 AM.
|