select WAREHOUSE.ITSNAME as WAREHOUSE, INVITEM.ITSID as INVITEMID, INVITEM.ITSNAME as INVITEM, UNITOFMEASURE.ITSNAME as UNITOFMEASURE, sum(THEREST) as THEREST
from WAREHOUSEREST
join INVITEM on INVITEM.ITSID=WAREHOUSEREST.INVITEM
join UNITOFMEASURE on UNITOFMEASURE.ITSID=WAREHOUSEREST.UNITOFMEASURE
join WAREHOUSESITE on WAREHOUSESITE.ITSID=WAREHOUSEREST.WAREHOUSESITE
join WAREHOUSE on WAREHOUSE.ITSID=WAREHOUSESITE.WAREHOUSE 
where THEREST!=0
group by WAREHOUSE.ITSNAME, INVITEM.ITSID, INVITEM.ITSNAME, UNITOFMEASURE.ITSNAME
order by WAREHOUSE.ITSNAME, INVITEM.ITSNAME;
