SELECT DISTINCT hp.party_name, hca.account_number,
hp.address1
|| ','
|| hp.address2
|| ','
|| hp.address3
|| ','
|| hp.city
|| ','
|| hp.state
|| ','
|| hp.county
|| ','
|| hp.postal_code address,
hca.creation_date
FROM hz_cust_accounts hca,
hz_cust_acct_sites_all hcas,
hz_parties hp
WHERE 1 = 1
AND hp.party_id = hca.party_id
AND hca.cust_account_id = hcas.cust_account_id
AND hcas.org_id = 83
AND TRUNC (hca.creation_date) BETWEEN TRUNC
(TO_DATE ('01-JAN-2012',
'DD-MON-YYYY'
)
)
AND TRUNC
(TO_DATE ('31-DEC-2012',
'DD-MON-YYYY'
)
)
ORDER BY hca.creation_date;
SELECT hp.party_name, hca.account_number, hps.party_site_number,
hl.address1
|| ', '
|| hl.address2
|| ', '
|| hl.address3
|| ', '
|| hl.city
|| ', '
|| hl.state
|| ', '
|| hl.country location_address,
DECODE (hcsu.status, 'A', 'Active', 'Inactive') status
FROM hz_cust_accounts hca,
hz_cust_acct_sites_all hcas,
hz_cust_site_uses_all hcsu,
hz_parties hp,
hz_party_sites hps,
hz_locations hl
WHERE hca.cust_account_id = hcas.cust_account_id
AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id
AND hcsu.site_use_code = 'SHIP_TO'
AND hca.party_id = hp.party_id
AND hp.party_id = hps.party_id
AND hps.party_site_id = hcas.party_site_id
AND hps.location_id = hl.location_id
AND hcas.org_id = 83
AND TRUNC (hps.creation_date) BETWEEN TRUNC (TO_DATE ('01-SEP-2012',
'DD-MON-YYYY'
)
)
AND TRUNC (TO_DATE ('31-DEC-2012',
'DD-MON-YYYY'
)
)
--AND hcsu.status='A'
--and HPS.PARTY_SITE_NUMBER in ('63564','63321')
ORDER BY hp.party_name;

Customer query and_sites_query

  • 1.
    SELECT DISTINCT hp.party_name,hca.account_number, hp.address1 || ',' || hp.address2 || ',' || hp.address3 || ',' || hp.city || ',' || hp.state || ',' || hp.county || ',' || hp.postal_code address, hca.creation_date FROM hz_cust_accounts hca, hz_cust_acct_sites_all hcas, hz_parties hp WHERE 1 = 1 AND hp.party_id = hca.party_id AND hca.cust_account_id = hcas.cust_account_id AND hcas.org_id = 83 AND TRUNC (hca.creation_date) BETWEEN TRUNC (TO_DATE ('01-JAN-2012', 'DD-MON-YYYY' ) ) AND TRUNC (TO_DATE ('31-DEC-2012', 'DD-MON-YYYY' ) ) ORDER BY hca.creation_date; SELECT hp.party_name, hca.account_number, hps.party_site_number, hl.address1 || ', ' || hl.address2 || ', ' || hl.address3 || ', ' || hl.city || ', ' || hl.state || ', ' || hl.country location_address, DECODE (hcsu.status, 'A', 'Active', 'Inactive') status FROM hz_cust_accounts hca, hz_cust_acct_sites_all hcas, hz_cust_site_uses_all hcsu, hz_parties hp, hz_party_sites hps, hz_locations hl WHERE hca.cust_account_id = hcas.cust_account_id AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id AND hcsu.site_use_code = 'SHIP_TO' AND hca.party_id = hp.party_id AND hp.party_id = hps.party_id AND hps.party_site_id = hcas.party_site_id AND hps.location_id = hl.location_id AND hcas.org_id = 83
  • 2.
    AND TRUNC (hps.creation_date)BETWEEN TRUNC (TO_DATE ('01-SEP-2012', 'DD-MON-YYYY' ) ) AND TRUNC (TO_DATE ('31-DEC-2012', 'DD-MON-YYYY' ) ) --AND hcsu.status='A' --and HPS.PARTY_SITE_NUMBER in ('63564','63321') ORDER BY hp.party_name;