Hi everybody,
I have a strange problem and I'm wondering what I can do to fix it?
As a result of my calculations I receive a cursor with 2 records.
One has 0 as a quantity and 0 as a CostOfGoodsOnHand
and the second record has -1 as quantity and -4.75 as CostOfGoodsOnHand.
I then use this formula
select iif(sum(QuantityOnHand) = 0, 0, sum(CostOfGoodsOnHand)*1.00/sum(QuantityOnHand)) as unit_cost from csr_AvgCost into cursor csrLastCost
and I get 5 as a result instead of 4.75
Do you know what may be a problem here?
Thanks in advance.
UPDATE. I figured it out.
If it's not broken, fix it until it is.
My Blog