SELECT BATCH_SEQ_NUM , CLIENT_ID ,sum(int( TRANS_AMOUNT )) FROM
ritadb30/request WHERE STATUS_CODE = 2 and CLIENT_ID = 100300001′
and command = COMPLETION GROUP BY BATCH_SEQ_NUM, CLIENT_ID ORDER
BY BATCH_SEQ_NUM desc
Then subtract
SELECT BATCH_SEQ_NUM , CLIENT_ID ,sum(int( TRANS_AMOUNT )) FROM
ritadb30/request WHERE STATUS_CODE = 2 and CLIENT_ID = 100300001′
and command = CREDIT GROUP BY BATCH_SEQ_NUM, CLIENT_ID ORDER
BY BATCH_SEQ_NUM desc