List:General Discussion« Previous MessageNext Message »
From:Rodney Broom Date:November 25 2002 6:05pm
Subject:Re: A SUM with more decimal places than the values being SUMed?
View as plain text  
From: Andrew Kuebler <akuebler@stripped>


> I'm running a query to SUM a Decimal field with the configuration of
> DECIMAL(6,2) and I get a result looking like: 56.551500000000009

Hi Andrew,

I just did this (v 3.23.52):

  mysql> create table dd ( myfloat decimal(6,2))
  mysql> insert into dd (myfloat) values (56.123456789), (1234.5678);

  mysql> select * from dd;
  +---------+
  | myfloat |
  +---------+
  | 1234.57 |
  |   56.12 |
  +---------+

  mysql> select sum(myfloat) from dd;
  +--------------+
  | sum(myfloat) |
  +--------------+
  |      1290.69 |
  +--------------+

Unless I'm missing something, this works as it should.

---
Rodney Broom
President, R.Broom Consulting
http://www.rbroom.com/



Thread
A SUM with more decimal places than the values being SUMed?Andrew Kuebler25 Nov
  • Re: A SUM with more decimal places than the values being SUMed?Rodney Broom25 Nov