客戶的相關設定(如收貨方,收單據方,帳戶幣種,信用限額,銷售員,銷售助理,付款方法,發運方式等)

-- 客戶的一些相關設定,如收貨方,收單據方,帳戶幣種,信用限額,銷售員,銷售助理,付款方法,發運方式等。

SELECT *
FROM (SELECT hcsua.org_id,                         --組織ID
             hcpa.cust_account_id AS customer_id,  -- 客戶ID
             hcpa.currency_code AS curr_code,       -- 幣種
             LAST_VALUE(overall_credit_limit) OVER(PARTITION BY hcsua.org_id, hcpa.cust_account_id, hcpa.currency_code) AS credit_limit   --信用限額
       FROM  apps.hz_cust_site_uses_all hcsua,
                    apps.hz_cust_profile_amts hcpa
      WHERE  hcpa.site_use_id = hcsua.site_use_id
        AND  hcsua.status = 'A'   --客戶是否有效
        and  hcsua.org_id=110
        and  hcpa.cust_account_id = 2321
   ORDER BY  hcpa.cust_account_id,
                        hcpa.currency_code,
                        hcpa.object_version_number)
GROUP BY org_id, customer_id, curr_code, credit_limit
ORDER BY org_id, customer_id, curr_code, credit_limit;

image

image

image

image

image

image

posted @ 2012-10-26 14:42  全威儒  阅读(628)  评论(0编辑  收藏  举报