SELECT A.BUSINESS_UNIT , A.INV_ITEM_ID , A.DT_TIMESTAMP , A.CM_UNIT_COST FROM PS_CM_PERDAVG_COST A , PS_BU_ITEMS_INV B , PS_CM_ITEM_LED_VW C WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.INV_ITEM_ID = B.INV_ITEM_ID AND A.COST_ELEMENT = B.COST_ELEMENT AND B.BUSINESS_UNIT = C.BUSINESS_UNIT AND B.INV_ITEM_ID = C.INV_ITEM_ID AND A.CM_BOOK = C.CM_BOOK AND C.DEFAULT_LEDGER_GRP = 'Y' AND C.PRIMARY_LEDGER = 'Y' AND A.DT_TIMESTAMP = ( SELECT MAX(D.DT_TIMESTAMP) FROM PS_CM_PERDAVG_COST D WHERE D.BUSINESS_UNIT = A.BUSINESS_UNIT AND D.INV_ITEM_ID = A.INV_ITEM_ID )
|