SELECT A.SETID , A.TREE_NAME , B.TREE_NODE_NUM , B.TREE_NODE , B.PARENT_NODE_NUM , B.PARENT_NODE_NAME , %Substring(J.DESCR60, 1, 30) , J.CATEGORY_ID , J.DESCR60 FROM PSTREEDEFN A , PSTREENODE B , PS_ITM_CAT_TBL J , PS_INSTALLATION_PO P WHERE A.SETID = B.SETID AND A.SETCNTRLVALUE = B.SETCNTRLVALUE AND A.TREE_NAME = B.TREE_NAME AND A.EFFDT = ( SELECT MAX(C.EFFDT) FROM PSTREEDEFN C WHERE A.SETID = C.SETID AND A.SETCNTRLVALUE = C.SETCNTRLVALUE AND A.TREE_NAME = C.TREE_NAME AND C.EFFDT <= %CurrentDateIn) AND A.EFFDT = B.EFFDT AND A.TREE_STRCT_ID = 'ITEMS' AND A.EFF_STATUS = 'A' AND A.SETID = J.SETID AND B.TREE_NODE = J.CATEGORY_CD AND J.CATEGORY_TYPE = P.CATEGORY_TYPE AND J.EFFDT = ( SELECT MAX(J2.EFFDT) FROM PS_ITM_CAT_TBL J2 WHERE J.SETID = J2.SETID AND J.CATEGORY_TYPE = J2.CATEGORY_TYPE AND J.CATEGORY_CD = J2.CATEGORY_CD AND J.CATEGORY_ID = J2.CATEGORY_ID AND J2.EFFDT <= %CurrentDateIn)
|