SELECT DISTINCT (SELECT S.BUSINNAME
FROM BNDICT_T_DICTIONARY S
WHERE S.BUSINTYPEID = 'WH_CITY'
AND S.BUSINID = P.CITY) CITY,
P.COUNTRY_AREA,
(SELECT S.BUSINNAME
FROM BNDICT_T_DICTIONARY S
WHERE S.BUSINTYPEID = 'WH_ACCOUNT_TYPE'
AND S.BUSINID = P.Account_Type) ACCOUNT_TYPE,
(SELECT S.BUSINNAME
FROM BNDICT_T_DICTIONARY S
WHERE S.BUSINTYPEID = 'WH_YS_PROJECT'
AND S.BUSINID = P.PROJECT) PROJECT,
P.COST_NAME,
P.PROVISION_AMOUNT,
(SELECT PO.PAY_TIME
FROM abc PO
WHERE PO.PAY_BATCH = '1'
AND P.CITY = PO.CITY
AND P.COUNTRY_AREA = PO.COUNTRY_AREA
AND P.PROJECT = PO.PROJECT
AND P.ACCOUNT_TYPE = PO.ACCOUNT_TYPE
AND P.COST_NAME = PO.COST_NAME
AND P.PROVISION_AMOUNT = PO.PROVISION_AMOUNT) TIME_ONE,
(SELECT PO.PAY_AMOUNT
FROM abc PO
WHERE PO.PAY_BATCH = '1'
AND P.CITY = PO.CITY
AND P.COUNTRY_AREA = PO.COUNTRY_AREA
AND P.PROJECT = PO.PROJECT
AND P.ACCOUNT_TYPE = PO.ACCOUNT_TYPE
AND P.COST_NAME = PO.COST_NAME
AND P.PROVISION_AMOUNT = PO.PROVISION_AMOUNT) AMOUNT_ONE,
(SELECT PO.NOTE
FROM abc PO
WHERE PO.PAY_BATCH = '1'
AND P.CITY = PO.CITY
AND P.COUNTRY_AREA = PO.COUNTRY_AREA
AND P.PROJECT = PO.PROJECT
AND P.ACCOUNT_TYPE = PO.ACCOUNT_TYPE
AND P.COST_NAME = PO.COST_NAME
AND P.PROVISION_AMOUNT = PO.PROVISION_AMOUNT) NOTE_ONE,
(SELECT PO.PAY_TIME
FROM abc PO
WHERE PO.PAY_BATCH = '2'
AND P.CITY = PO.CITY
AND P.COUNTRY_AREA = PO.COUNTRY_AREA
AND P.PROJECT = PO.PROJECT
AND P.ACCOUNT_TYPE = PO.ACCOUNT_TYPE
AND P.COST_NAME = PO.COST_NAME
AND P.PROVISION_AMOUNT = PO.PROVISION_AMOUNT) TIME_TWO,
(SELECT PO.PAY_AMOUNT
FROM abc PO
WHERE PO.PAY_BATCH = '2'
AND P.CITY = PO.CITY
AND P.COUNTRY_AREA = PO.COUNTRY_AREA
AND P.PROJECT = PO.PROJECT
AND P.ACCOUNT_TYPE = PO.ACCOUNT_TYPE
AND P.COST_NAME = PO.COST_NAME
AND P.PROVISION_AMOUNT = PO.PROVISION_AMOUNT) AMOUNT_TWO,
(SELECT PO.NOTE
FROM abc PO
WHERE PO.PAY_BATCH = '2'
AND P.CITY = PO.CITY
AND P.COUNTRY_AREA = PO.COUNTRY_AREA
AND P.PROJECT = PO.PROJECT
AND P.ACCOUNT_TYPE = PO.ACCOUNT_TYPE
AND P.COST_NAME = PO.COST_NAME
AND P.PROVISION_AMOUNT = PO.PROVISION_AMOUNT) NOTE_TWO,
(SELECT PO.PAY_TIME