SELECT DISTINCT L.SETID , L.LANGUAGE_CD , L.DESCR , F.DESCR FROM PSTREEDEFN A , %Table(SET_CNTRL_TREE) B , PSTREESTRCT C , %Table(INSTALLATION_RS) D , %Table(SETID_LANG) L , PSTREEDEFNLANG F WHERE A.SETID = B.SETID AND A.TREE_NAME = B.TREE_NAME AND A.TREE_NAME = D.TREE_NAME AND A.TREE_STRCT_ID = C.TREE_STRCT_ID AND (C.NODE_RECNAME = D.ORG_RECNAME OR C.DTL_RECNAME = D.ORG_RECNAME) AND A.EFF_STATUS = 'A' AND A.EFFDT = ( SELECT MAX(EFFDT) FROM PSTREEDEFN E WHERE E.SETID = A.SETID AND E.TREE_NAME = A.TREE_NAME AND E.SETCNTRLVALUE = A.SETCNTRLVALUE AND E.EFFDT <= %CurrentDateIn AND E.EFF_STATUS = 'A') AND A.SETID = L.SETID AND F.SETID = A.SETID AND F.SETCNTRLVALUE = A.SETCNTRLVALUE AND F.TREE_NAME = A.TREE_NAME AND F.EFFDT = A.EFFDT
|