select a.trx_date,
sum(b.unit_selling_price *
NVL(b.QUANTITY_CREDITED, b.QUANTITY_INVOICED)) as amount
from ra_customer_trx_all a, ra_customer_trx_lines_all b
where a.customer_trx_id = b.customer_trx_id
and a.trx_date >= to_date('20050101', 'YYYYMMDD')
and a.trx_date < to_date('20050701', 'YYYYMMDD')
and a.org_id = 85
group by a.trx_date