Friday, February 10, 2017
SQL - AR Customer - Bill to site addresses
SELECT
party.party_name "Customer Name",
loc.ADDRESS1
|| ' '
|| loc.ADDRESS2
|| ' '
|| loc.ADDRESS3
|| ' '
|| loc.POSTAL_CODE
|| ' '
|| loc.CITY
|| ' '
|| NVL (loc.STATE, loc.PROVINCE)
|| ' '
|| loc.COUNTRY
|| ' '
|| ship.location
"Bill to address "
FROM apps.hz_cust_accounts cust,
apps.hz_cust_acct_sites_all acct,
apps.hz_cust_site_uses_all ship,
apps.hz_party_sites party_site,
apps.hz_locations loc,
apps.hz_parties party
WHERE cust.cust_account_id = acct.cust_account_id
AND acct.cust_acct_site_id = ship.cust_acct_site_id
AND acct.ORG_ID = ship.ORG_ID
AND ship.SITE_USE_CODE = 'BILL_TO'
AND cust.status = 'A'
AND loc.location_id = party_site.location_id
AND acct.party_site_id = party_site.party_site_id
AND cust.party_id = party.party_id
AND party.party_name LIKE '96%'
ORDER BY 1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment