Tuesday, December 13, 2011
R12 AR Customer Query
SELECT hp.party_number
,hp.party_name
,hp.party_type
,hp.orig_system_reference
--,hp.category_code
--,hp.jgzz_fiscal_code taxpayer_id
,hp.status
,hp.tax_name
,hp.person_first_name
,hp.person_middle_name
,hp.person_last_name
,hp.person_title
,hp.country
,hp.address1
,hp.address2
,hp.address3
,hp.address4
,hp.city
,hp.postal_code
,hp.state
,hp.province
,hca.status account_status
,hca.created_by_module
,hp.county
,hca.account_number
,hca.customer_type
,hca.account_established_date
,hca.account_activation_date
,hca.account_name
,hca.tax_code
--,hca.attribute2 -- Added on 24-07-09
,hca.attribute3
,hcpc.profile_class_id
,hcpc.status rec_status
,hp.sic_code_type category_code
,hca.customer_class_code
,hca.orig_system_reference acct_orig_sys_ref
,hp.tax_reference tax_reg_number
,hcpc.NAME profile_class
,hcp.dunning_letters
,hcp.override_terms
,hcp.credit_balance_statements -- Added on 24-07-09
,hcpc.statements -- Added on 24-07-09
,rt.NAME payment_term
,arsc.NAME statement_cycle -- Added on 24-07-09
,arc.NAME collector_name -- Added on 24-07-09
FROM ar.hz_parties hp
,ar.hz_cust_accounts hca
,ar.hz_customer_profiles hcp
,ar.ra_terms_tl rt
,ar.hz_cust_profile_classes hcpc
,ar.ar_statement_cycles arsc
,ar.ar_collectors arc
--,ap_terms_tl att
WHERE hp.party_id = hca.party_id
AND hcp.party_id = hp.party_id
AND hca.cust_account_id = hcp.cust_account_id
AND hcp.site_use_id IS NULL
AND hca.payment_term_id = rt.term_id(+)
AND hcpc.profile_class_id = hcp.profile_class_id
AND arsc.statement_cycle_id(+) = hcpc.statement_cycle_id
AND arc.collector_id = hcpc.collector_id
AND hp.status = 'A'
AND hca.status = 'A'
AND hcp.status = 'A'
AND hcpc.status = 'A'
AND hp.party_type = 'ORGANIZATION'
--AND hp.party_name='BARCLAYS BANK PLC'
--and att.term_id(+)=rt.term_id
--and rownum<11
order by 2
Labels:
AR
Subscribe to:
Post Comments (Atom)
I was having trouble with the relations. Your query helped me overcome that. Thank you for that.
ReplyDelete