Query : To retrieve transactions with a certain amount open (dunning charges amount)

SELECT pse.customer_id, hza.account_number, hza.account_name,
pse.trx_number, pse.trx_date, pse.amount_due_original,
pse.amount_due_remaining
FROM apps.ar_payment_schedules_all pse, apps.hz_cust_accounts hza
WHERE 1 = 1
AND pse.customer_id = hza.cust_account_id
to_char(xmv.customer_id) als type
and hza.CUST_ACCOUNT_ID > -1
AND pse.status = 'OP'
AND pse.CLASS IN ('INV', 'CM')
HAVING SUM (pse.amount_due_remaining) =4.50 --- this must be your condition
GROUP BY pse.customer_id,
hza.account_number,
hza.account_name,
pse.trx_number,
pse.trx_date,
pse.amount_due_original,
pse.amount_due_remaining

0 comments:

Post a Comment