What is Query for getting customers having multiple accounts?
FROM hz_parties hp, hz_Cust_Accounts hca,ar.ra_customers rc
WHERE hp.party_id = hca.party_id
and rc.customer_id=hca.cust_Account_id
AND hca.cust_account_id IN (
SELECT customer_id
FROM ap_bank_account_uses_all bauses,
ap_bank_accounts_all bacct
WHERE bauses.external_bank_account_id = bacct.bank_account_id
AND primary_flag = ‘Y’
GROUP BY customer_id)
HAVING COUNT (DISTINCT (external_bank_account_id)) > 1)
Leave a Reply
Want to join the discussion?Feel free to contribute!