""RedRed!com IT Department"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Jay Blanchard wrote:
>> [snip]
>> I read this as a SQL syntax question, not a math word problem.  As in
>>
>> SELECT ..., (some expression equaling sq ft) AS sqft... [/snip]
>>
>> Cool, then do it!
>>
>
>
> It would all depend on how he has his feet and inches saved in the 
> table,
> and of course, the field names. If we can get that info then maybe we 
> would be better able to post a solution.

Sorry Guys, I am just storing the X and Y, so 6 foot 11 inches would be 
stored as 6.11 

----------------

I hope the data type is a varchar or something like that.

So if I am right the "decimal" (actually it's pseudo-duodecimal) part is
stored as "00" to "11"?

I would use string functions to separate the pseudo-duodecimal parts, devide
it by 12 to make it a decimal, add to the feet parts, then use these values
to get a square footage in decimals. 

Table dimensions:

ID      X       Y
1       6.11    5.04
2       6.02    6.00

select  ID,
cast((right(x, 2)  / 12 + left(x,length(x)-3)) as decimal) as decimalX,
cast((right(y, 2)  / 12 + left(y,length(y)-3)) as decimal) as decimalY,
cast((right(x, 2)  / 12 + left(x,length(x)-3)) as decimal) * cast((right(y,
2)  / 12 + left(y,length(y)-3)) as decimal) as decimalSQFT
from dimensions

Gives:

ID      decimalX        decimalY        decimalSQFT
1       6.92    5.33    36.8836
2       6.17    6       37.02

Now if you want to convert the decimal part into square inches, you're on
your own!





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to