Search This Blog

Showing posts with label Active Customers AR. Show all posts
Showing posts with label Active Customers AR. Show all posts

Saturday, November 20, 2010

Active Customer List

SELECT party.party_name customer_name, acnt.account_number customer_number,
       SUBSTRB (loc.address1, 1, 200) address_line_1,
       SUBSTRB (loc.city, 1, 15) city
  FROM hz_cust_accounts acnt,
       hz_parties party,
       hz_cust_acct_sites_all site,
       hz_cust_site_uses_all uses,
       hz_party_sites ps,
       hz_locations loc
 WHERE acnt.status = 'A'
   AND party.party_id = acnt.party_id
   AND acnt.cust_account_id = site.cust_account_id(+)
   AND site.status(+) = 'A'
   AND site.cust_acct_site_id = uses.cust_acct_site_id(+)
   AND ps.party_site_id(+) = site.party_site_id
   AND uses.site_use_code(+) = 'BILL_TO'
   AND loc.location_id(+) = ps.location_id