Search from 700 + Posts

Jan 18, 2017

Query to get Customer data from HZ tables

Query to get Customer data from HZ tables


SELECT p.party_id,
          p.party_number,
          p.party_type,
          p.creation_date party_creation_date,
          p.party_name,
          ca.account_number customer_number,
          ca.customer_type,
          ca.customer_class_code,
          ca.sales_channel_code,
          cas.status site_status,
          csu.site_use_code,
          csu.location,
          loc.address1,
          loc.address2,
          loc.address3,
          loc.address4,
          loc.city,
          loc.state,
          loc.postal_code,
          loc.county,
          loc.country,
          ca.sales_channel_code rev_type,
          csu.site_use_id,
          ps.party_site_id,
          ca.cust_account_id,
          cas.cust_acct_site_id
     FROM apps.hz_parties p,  
          apps.hz_cust_accounts ca,
          apps.hz_cust_acct_sites_all cas,
          apps.hz_cust_site_uses_all csu,
 apps.hz_party_sites ps,
          apps.hz_locations loc
    WHERE  p.party_id = ca.party_id    
          AND ca.cust_account_id = cas.cust_account_id
          AND cas.cust_acct_site_id = csu.cust_acct_site_id
 AND ca.party_id = ps.party_id
          AND cas.party_site_id = ps.party_site_id
 AND ps.location_id = loc.location_id ;

No comments:

Post a Comment