select 
o.obj_category as equipmentcategory,
o.obj_class as equipmentclass,
o.obj_class_org as equipmentclassorg,
o.obj_code as equipmentcode,
o.obj_desc as equipmentdescription,
o.obj_org as equipmentorganization,
o.obj_obtype as equipmenttype,
o.obj_obtype as equipmenttypecode,
o.obj_linearrefuom linearreferenceuom
from r5objects o, 
r5userorganization u where o.obj_obrtype IN ('A','P','S','L')    
and IFNULL(o.obj_notused, '-') <> '+'    and o.obj_code <>'*'    
and exists (select 1 from r5aspectpoints a 
where o.obj_code = a.apo_object or a.apo_object = o.obj_category)    and o.obj_org = u.uog_org    
and u.uog_user =<parameter.r5user> and ( u.uog_common = '+' or u.uog_org = <control.org> ) 
