SELECT a.business_unit ,a.item_term ,r.language_cd ,r.descr FROM ps_item_sf a , ps_bus_unit_tbl_sf c , PS_ITEM_TYPE_TBL d , ps_item_type_lng r WHERE a.sa_id_type = 'P' AND a.business_unit = c.business_unit AND a.item_type = d.item_type AND d.item_type_cd IN ('A','C','H','X','B','W') 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 = r.setid AND d.item_type = r.item_type AND d.effdt = r.effdt GROUP BY a.business_unit, a.item_term,r.language_cd,r.descr
|