Thursday, 4 February 2016

How to get address details with party name and site_use_code(ship to,bill to) in oracle

select hp.party_name,
hca.account_number, 
jra.resource_name,
hcsu.site_use_code,
hl.address1,
hl.address2,
hl.address3,
hl.address4,
hl.city,
hl.state,
hl.postal_code,
hl.country
from hz_parties hp,
hz_cust_accounts_all hca,
hz_cust_acct_sites_all hcas,
hz_cust_site_uses_all hcsu,
hz_party_sites hps,
hz_locations hl,
ra_salesreps_all rsa,
jtf_rs_all_resources_vl jra
where hca.party_id = hp.party_id
--and hca.account_number='5731'
and hcas.cust_account_id = hca.cust_account_id
and hcas.cust_acct_site_id = hcsu.cust_acct_site_id
--and hcsu.site_use_code='SHIP_TO'
and hcas.party_site_id = hps.party_site_id
and hps.location_id = hl.location_id
and hcsu.primary_salesrep_id = rsa.salesrep_id
and rsa.resource_id = jra.resource_id;

No comments:

Post a Comment