SELECT A.SETID , A.TREE_NAME , A.TREE_HAS_RANGES , B.TREE_NODE_NUM , B.TREE_NODE , C.RANGE_FROM , C.RANGE_TO , C.DYNAMIC_RANGE , D.CATEGORY_ID FROM PSTREEDEFN A , PSTREENODE B , PSTREELEAF C , PS_ITM_CAT_TBL D WHERE A.TREE_STRCT_ID = 'ITEMS' AND A.EFF_STATUS = 'A' AND A.EFFDT = ( SELECT MAX(EFFDT) FROM PSTREEDEFN WHERE SETID = A.SETID AND SETCNTRLVALUE = A.SETCNTRLVALUE AND TREE_NAME = A.TREE_NAME AND EFFDT <= %CurrentDateIn ) AND A.SETID = B.SETID AND A.SETCNTRLVALUE = B.SETCNTRLVALUE AND A.TREE_NAME = B.TREE_NAME AND A.EFFDT = B.EFFDT AND A.SETID = C.SETID AND A.SETCNTRLVALUE = C.SETCNTRLVALUE AND A.TREE_NAME = C.TREE_NAME AND A.EFFDT = C.EFFDT AND B.TREE_NODE_NUM = C.TREE_NODE_NUM AND A.SETID = D.SETID AND B.TREE_NODE = D.CATEGORY_CD AND D.EFFDT = ( SELECT MAX(EFFDT) FROM PS_ITM_CAT_TBL WHERE SETID = D.SETID AND CATEGORY_CD = D.CATEGORY_CD AND EFFDT <= %CurrentDateIn)
|