SELECT a.business_unit ,a.emplid ,a.ext_org_id ,x.item_type ,x.LANGUAGE_CD ,x.descr FROM ps_item_line_sf a , ps_item_sf b , ps_bus_unit_tbl_sf c , PS_ITEM_TYPE_TBL 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.business_unit = c.business_unit AND d.item_type = b.item_type AND d.setid = ( SELECT e.setid FROM ps_set_cntrl_rec e WHERE e.setcntrlvalue = c.institution AND e.recname = 'ITEM_TYPE_TBL') AND d.effdt = ( SELECT MAX(f.effdt) FROM PS_ITEM_TYPE_TBL f WHERE f.setid = d.setid AND f.item_type = d.item_type AND f.effdt <= %CurrentDateIn) AND d.eff_status = 'A' AND d.setid = x.setid AND d.item_type=x.item_type AND d.effdt = x.effdt
|