SELECT A.SETID ,B.TREE_NAME ,A.INV_ITEM_ID ,A.DESCR FROM PS_MASTER_ITEM_TBL A , PSTREENODE B , PSTREELEAF C , PS_PURCH_ITEM_ATTR D WHERE A.SETID = B.SETID AND A.SETID = C.SETID AND A.SETID = D.SETID AND A.INV_ITEM_ID = D.INV_ITEM_ID AND %CurrentDateIn BETWEEN D.PO_AVAIL_DT AND D.PO_UNAVAIL_DT AND (C.DYNAMIC_RANGE = 'Y' OR (A.INV_ITEM_ID >= C.RANGE_FROM AND A.INV_ITEM_ID <= C.RANGE_TO)) AND B.EFFDT = ( SELECT MAX(EFFDT) FROM PSTREENODE WHERE SETID = B.SETID AND EFFDT <= %CurrentDateIn AND TREE_NAME = B.TREE_NAME) AND A.CATEGORY_ID = B.TREE_NODE AND B.EFFDT = C.EFFDT AND B.TREE_NAME = C.TREE_NAME AND B.TREE_NODE_NUM = C.TREE_NODE_NUM AND A.ITM_STATUS_CURRENT = '1'
|