SELECT A.ACCOUNT_ID, A.DESCRIPTION, A.TOTAL_BALANCE, A.DATA_CENTER, A.SALES_AMT, CASE WHEN A.ACCOUNT_ID = '10-200' AND A.DATA_CENTER = 'K00300' THEN (A.TOTAL_BALANCE - B.SALES_AMT) ELSE (A.TOTAL_BALANCE + A.SALES_AMT) END NEW_TOTAL FROM ACCOUNT_TEMP A LEFT OUTER JOIN ( SELECT A.ACCOUNT_ID, SUM(A.SALES_AMT) SALES_AMT FROM ACCOUNT_TEMP A GROUP BY A.ACCOUNT_ID ) B ON B.ACCOUNT_ID = A.ACCOUNT_ID
|How to query date ranges with SQL||6||38|
|How to base a filter depending on fields contents?||15||48|
|Update data using formula||22||21|
|Oracle 10g - Select rows into colums||4||12|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
16 Experts available now in Live!