LEFT JOIN (SELECT *
FROM (SELECT B.BILL_CODE,
B.ACK_CODE,
ROW_NUMBER() OVER(PARTITION BY B.ACK_CODE ORDER BY B.BILL_CODE) R
FROM TAB_BILL_JHD_ACKREL B)
WHERE R = 1) S
ON S.ACK_CODE = T.BILL_CODE