SELECT A.BUSINESS_UNIT , A.COMMON_ID , A.ACCOUNT_NBR , A.ACCOUNT_TERM , x.LANGUAGE_CD , x.DESCR FROM PS_ITEM_LINE_SF A , PS_ITEM_SF B , PS_ITEM_TYPE_TBL C , PS_BUS_UNIT_TBL_SF D ,PS_ITEM_TYPE_LNG x WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.COMMON_ID = B.COMMON_ID AND A.SA_ID_TYPE = B.SA_ID_TYPE AND A.ITEM_NBR = B.ITEM_NBR AND A.SA_ID_TYPE = 'P' AND A.BUSINESS_UNIT = D.BUSINESS_UNIT AND B.ITEM_TYPE = C.ITEM_TYPE AND C.EFFDT = ( SELECT MAX(E.EFFDT) FROM PS_ITEM_TYPE_TBL E WHERE C.SETID = E.SETID AND C.ITEM_TYPE = E.ITEM_TYPE AND E.EFFDT <= %CurrentDateIn) AND C.SETID = ( SELECT F.SETID FROM PS_SET_CNTRL_REC F WHERE F.SETCNTRLVALUE = D.INSTITUTION AND F.RECNAME = 'ITEM_TYPE_TBL') AND c.setid = x.setid AND c.item_type=x.item_type AND c.effdt = x.effdt
|