SELECT DISTINCT A.DFI_ID_NUM , D.XLATLONGNAME FROM PS_BANK_ACCT_DEFN A , PS_BANK_ACCT_CPTY B , PS_BANK_CD_TBL C , PSXLATITEM D WHERE A.SETID = B.SETID AND A.BANK_CD = B.BANK_CD AND A.BANK_CD_CPTY = B.BANK_CD_CPTY AND A.BANK_ACCT_KEY = B.BANK_ACCT_KEY AND A.DFI_ID_NUM <> ' ' AND C.SETID = B.SETID AND C.BANK_CD = B.BANK_CD AND A.DFI_ID_QUAL = D.FIELDVALUE AND D.FIELDNAME = 'DFI_ID_QUAL' AND D.EFF_STATUS = 'A' AND D.EFFDT = ( SELECT MAX(Z.EFFDT) FROM PSXLATITEM Z WHERE Z.FIELDNAME = D.FIELDNAME AND Z.FIELDVALUE = D.FIELDVALUE AND Z.EFFDT <= %CurrentDateIn)
|