SELECT DISTINCT a.business_unit , b.production_id , c.prdn_area_code , a.inv_item_id , a.inv_lot_id , a.serial_id FROM ps_physical_inv a , ps_sf_prdnid_headr b , PS_SF_PRDN_AREA c WHERE a.business_unit = c.business_unit AND b.business_unit = c.business_unit AND a.business_unit = c.business_unit AND b.prdn_area_code = c.prdn_area_code AND a.qty > 0 AND a.avail_status IN ('1','2') AND ((a.storage_area = c.storage_area AND a.stor_level_1 = c.stor_level_1 AND a.stor_level_2 = c.stor_level_2 AND a.stor_level_3 = c.stor_level_3 AND a.stor_level_4 = c.stor_level_4) OR (a.storage_area = c.non_own_stor_area AND a.stor_level_1 = c.non_own_stor_lev1 AND a.stor_level_2 = c.non_own_stor_lev2 AND a.stor_level_3 = c.non_own_stor_lev3 AND a.stor_level_4 = c.non_own_stor_lev4))
|