SHARE
TWEET

Untitled

a guest Aug 13th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT TXNID,
  2.        TOTAL_AMOUNT,
  3.        ACCOUNT_CATEGORY,
  4.        DEBIT
  5. FROM ACCOUNTING_BOOK
  6.   WHERE TXNID like 'M003%' ;
  7.    
  8. TXNID:M003 TOTAL_AMT:25 ACCOUNT_CATEGORY:Revenue Debit:null Credit:null
  9.  
  10. TXNID:M003 TOTAL_AMT:25 ACCOUNT_CATEGORY:Asset Debit:null Credit:null
  11.    
  12. update accounting_book11 a_R set  DEBIT= CASE WHEN ACCOUNT_CATEGORY IN('Expense','Asset')
  13.               then (SELECT SUM(TOTAL_AMOUNT)
  14.               FROM ACCOUNTING_BOOK11
  15.               WHERE ACCOUNTCATEGORY='Revenue'
  16.               AND TXNID=a_R.TXNID)
  17.               ELSE 0
  18.               END;
RAW Paste Data
Top