optimizing the sql query by not repeating the math..

Posted by user333747 on Stack Overflow See other posts from Stack Overflow or by user333747
Published on 2010-05-05T18:41:18Z Indexed on 2010/05/05 18:48 UTC
Read the original article Hit count: 293

Filed under:
|
|
|
|

Here is the query in Oracle I was trying to remove the redundant math operation from:

SELECT name,

     CASE 
       when nvl(num1,0) + nvl(num2,0) - nvl(num3,0) > 0
       THEN nvl(num1,0) + nvl(num2,0) - nvl(num3,0)
       ELSE 0
      END
      as result,
      .... from ....

How do I not repeat the summation above?

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about sql