Re: Calculating square root in sql statement ????
Posted in 1994
Hugh Grierson — — source: Informix-list mailing list archive (1991-1998)
In article <30oq11$15o@emory.mathcs.emory.edu> johnl@informix.com (Jonathan Leffler) writes:
>>From: weller@zorro.cecer.army.mil (Bonnie Weller)
>>I need to compute the following into an sql statement.
>>
>> _____________________
>>\\ | 2 2
>> \\| (x1-x2) + (y1-y2) < r1+r2
>>
>>I am not sure how to do the square root part of the equation as isql does
>>not have this capability.
...
>SELECT *
> FROM File1
> WHERE ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) < (r1+field3)*(r1+field3);
Very good, but you'll also have to throw in an
AND r1+field3 > 0
if you need to handle the case where r1+field3 could be negative.
Regards...
--
Hugh Grierson hugh@fujitsu.co.nz 15C, heavy rain