select @outMoney=isnull(sum(amount*price),0) from oilOutWare where riqi<@endriqi and oilId=@oilId