I am trying to write a query which checks if 2 amounts have the same sign (+ or -). Do you have a good solutions that can be used?
Something like: If SAMESIGN(value1, value2) then do something
CASE WHEN (value1 * value2) < 0 THEN 'DiffSign' ELSE 'SameSignOrOneIsZero' END
Try to use sign function as below
case
when sign(value1)=sign(value2) then 'the same sign'
else 'different sign'
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With