SELECT DISTINCT ract.org_id,
hou.name operating_unit,
rabs.name source,
ract.trx_number,
ract.trx_date,
ract.set_of_books_id,
rac_bill.account_number bill_to_cusomer_number,
hp_bill.party_name bill_to_cusomer,
rac_ship.account_number ship_to_customer_number,
hp_ship.party_name ship_to_cusomer
FROM hr_operating_units hou,
ra_customer_trx_all ract,
ra_batch_sources_all rabs,
hz_cust_accounts_all rac_bill,
hz_parties hp_bill,
hz_cust_accounts_all rac_ship,
hz_parties hp_ship
WHERE hou.organization_id = ract.org_id
AND ract.complete_flag = 'N'
AND ract.batch_source_id = rabs.batch_source_id
AND ract.bill_to_customer_id = rac_bill.cust_account_id(+)
AND ract.ship_to_customer_id = rac_ship.cust_account_id(+)
AND TRUNC (ract.trx_date) BETWEEN '01-OCT-16' AND '31-OCT-17'
AND rac_bill.party_id = hp_bill.party_id
AND rac_ship.party_id = hp_ship.party_id
ORDER BY ract.org_id
hou.name operating_unit,
rabs.name source,
ract.trx_number,
ract.trx_date,
ract.set_of_books_id,
rac_bill.account_number bill_to_cusomer_number,
hp_bill.party_name bill_to_cusomer,
rac_ship.account_number ship_to_customer_number,
hp_ship.party_name ship_to_cusomer
FROM hr_operating_units hou,
ra_customer_trx_all ract,
ra_batch_sources_all rabs,
hz_cust_accounts_all rac_bill,
hz_parties hp_bill,
hz_cust_accounts_all rac_ship,
hz_parties hp_ship
WHERE hou.organization_id = ract.org_id
AND ract.complete_flag = 'N'
AND ract.batch_source_id = rabs.batch_source_id
AND ract.bill_to_customer_id = rac_bill.cust_account_id(+)
AND ract.ship_to_customer_id = rac_ship.cust_account_id(+)
AND TRUNC (ract.trx_date) BETWEEN '01-OCT-16' AND '31-OCT-17'
AND rac_bill.party_id = hp_bill.party_id
AND rac_ship.party_id = hp_ship.party_id
ORDER BY ract.org_id
No comments:
Post a Comment