Sql query to find the balances for a customer account wise.
Could someone help me with the sql query to find the balances for each customer account wise. This is need to generate the report.
presently we are using this query, but the output doesnot return the expected result.
SELECT sum(nvl(ps.acctd_amount_due_remaining,0)) "Balance"
FROM ra_cust_trx_line_gl_dist_all gld,
WHERE c.CHART_OF_ACCOUNTS_ID = 101
and gld.code_combination_id = c.code_combination_id
and ps.gl_date <= :PDATE
and ps.class in ('GUAR','INV','DM','DEP')
Thanks in advance.
Can someone help us with this.