Tuesday, 22 July 2025

Query to find customer number and name from project

 SELECT
    ppa.project_id,
    ppa.segment1,
    ppa.name,
    hp.party_name,
    hca.account_number,
    hcp.credit_checking,
    hcp.credit_hold
FROM
    pa_projects_all         ppa,
    pa_project_customers    ppc,
    hz_cust_accounts        hca,
    hz_customer_profiles    hcp,
    hz_cust_acct_sites_all  hcasa,
    hz_parties              hp
WHERE
        1 = 1
    AND ppa.project_id = ppc.project_id
    AND ppc.customer_id = hca.cust_account_id
    AND hp.party_id = hca.party_id
    AND hca.cust_account_id = hcp.cust_account_id
    AND ppc.bill_to_address_id = hcasa.cust_acct_site_id
    AND hcp.site_use_id IS NULL
    AND ppa.segment1 = '1111111';

No comments:

Post a Comment