bobdylan75
asked on
db2 sql: if A-B <0 then return 0 else return a-b
Hi,
In DB2 sql syntax
how to do the function below?
SELECT Qcode, iif( sum(A)>= sum(B), 0, SUM(B) - SUM(A)) AS QTy
FROM [...] group by Qcode
in other world, how to do the same of IIF function seen that it doesn't exist in db2?
(v5r4m0)
Or is there a function which return number 'A' if it is positive
and Zero if it is negative?
In DB2 sql syntax
how to do the function below?
SELECT Qcode, iif( sum(A)>= sum(B), 0, SUM(B) - SUM(A)) AS QTy
FROM [...] group by Qcode
in other world, how to do the same of IIF function seen that it doesn't exist in db2?
(v5r4m0)
Or is there a function which return number 'A' if it is positive
and Zero if it is negative?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER