All,

I need an SQL statement to determine if two fields have the same sign.

There's the obvious..

select
case
when Fld1 <= 0 and Fld2 <= 0 then 'Yes'
when Fld1 >= 0 and Fld2 >= 0 then 'Yes'
else 'No'
end as Same_Sign
from myFile

And the slightly tricky (Though I haven't quite convinced myself
that it'd work :)
select
case
when abs(fld1) + abs(fld2) = abs(fld1 + fld2) then 'Yes'
else 'No'
end as Same_Sign
from myFile


Anybody have any thoughts on either one of the above methods or an
alternative method?

The statement in question will be dealing with a couple of 80M record files.

Thanks!
Charles Wilt




Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2015 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact