select distinct  substr(sap.newvalue,1,4) sitenum,sap.siteid  from locations l ,MAXIMO.MAXXREFOVERVAL@getsapinfo sap  
where sap.siteid = l.siteid and l.location = sap.value  and l.type = 'STOREROOM' and l.status='OPERATING'  and sap.ifacecontrol='SAPSTORERM' ;