_mario.lat wrote:
> On Tue, 07 Nov 2006 06:40:48 -0500, Jerry Stuckle wrote:
>
>
>>_mario.lat wrote:
>>
>>>Hallo,
>>>I have a problem with a query like that:
>>>SELECT SUM(price) as total FROM product GROUP BY type
>>>
>>>price is float or double.
>>>total is not the exact sum.
>>>How can I do?
>>>Thank you in advance,
>>>Mario.
>>
>>Mario,
>>
>>What do you mean "total is not the exact sum"?
>
>
> Thankyou to all for answering (and reading) me.
>
> If you have a table with the value:
> type,price
> a,1.2
> b,0.1
> c,3.4
>
> real SUM (or real total) is 1.2+0.1+3.4 = 4.6
> the query
> SELECT SUM(price) as total FROM product GROUP BY type
> give me: total 4.5 for example.
>
> Thankyou again,
> Mario.
Mario,
Hmmm, I agree with Brian. I can't replicate your problem either. You
will have a slight error due to floating point storage format as
indicated by Gordon, but it should be quite a bit smaller than what you
show.
What do you get if you do a SELECT type, total FROM product?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================