SELECT hp.PARTY_NUMBER AS PARTY_NUM,
DECODE(hpua.PARTY_USAGE_CODE, 'CUSTOMER' , hp.PARTY_NAME, NULL ) AS CUSTOMER,
DECODE(hpua.PARTY_USAGE_CODE, 'SUPPLIER', hp.PARTY_NAME, NULL) AS SUPPLIER,
hpua.PARTY_USAGE_CODE AS PARTY_TYPE
FROM HZ_PARTIES hp,
HZ_PARTY_USG_ASSIGNMENTS hpua
WHERE hp.PARTY_ID=hpua.PARTY_ID
AND hpua.PARTY_USAGE_CODE IN ('CUSTOMER', 'SUPPLIER');
No comments:
Post a Comment