×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
What about:
Select case when sign(Col1) = sign(col2) Then 'Yes' else 'No End
From MyTable;
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Charles Wilt
Gesendet: Thursday, 03. September 2009 19:09
An: Midrange Systems Technical Discussion
Betreff: SQL to determine if two numeric columns have the same sign.
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
As an Amazon Associate we earn from qualifying purchases.