Thursday, 17 July 2014

Supplier's Payment Methods Query

/* Formatted on 7/17/2014 8:03:17 PM (QP5 v5.115.810.9015) */
SELECT            /*+  ORDERED
                       USE_NL (spu ss epa ppm)
                  */
      sup.vendor_name,
       sup.segment1 vendor_number,
       sup.party_id,
       epa.payee_party_id,
       epa.supplier_site_id,
       ss.vendor_site_code,
       ppm.payment_method_code,
       ppm.primary_flag
FROM ap_suppliers sup,
     ap_supplier_sites_all ss,
     iby.iby_external_payees_all epa,
     iby_ext_party_pmt_mthds ppm
WHERE     sup.vendor_id = ss.vendor_id
      AND ss.vendor_site_id = epa.supplier_site_id        --epa.payee_party_id
      AND epa.ext_payee_id = ppm.ext_pmt_party_id
      AND sup.creation_date BETWEEN SYSDATE - 300 AND SYSDATE - 290
      -- Modify above condition or add new conditions to get desired supplier's info
      AND ss.inactive_date IS NULL
      AND sup.end_date_active IS NULL
      AND ppm.inactive_date IS NULL
      AND epa.inactive_date IS NULL

No comments:

Post a Comment