SELECT hl.address1, hl.address2, hl.address3,
hl.address4, hl.city, hl.postal_code
FROM hz_locations hl,
hz_party_sites hps,
hz_parties hp,
hz_cust_accounts hca,
hz_cust_acct_sites_all has,
hz_cust_site_uses_all hcs
WHERE hcs.site_use_code = 'BILL_TO'
AND has.cust_acct_site_id = hcs.cust_acct_site_id
AND has.party_site_id = hps.party_site_id
AND hca.cust_account_id = has.cust_account_id
AND hp.party_id = hca.party_id
AND hps.party_id = hp.party_id
AND hl.location_id = hps.location_id
AND hca.cust_account_id = oe_order_headers_all.sold_to_org_id
AND hcs.site_use_id = oe_order_headers_all.invoice_to_org_id;
No comments:
Post a Comment