Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Simple Query - decimals appear where they should not - DBISAM 3.24
Sun, Oct 20 2019 2:11 PMPermanent Link

Kees Lagendijk

I have a simple table with 855 records and run the following query:

select sum(brutobedrag) as bruto, sum(nettobedrag) as netto from adm_bank

The result should be:

Bruto              Netto
400.85            400.85

but the result is as follows:

Bruto                                  Netto
400.850000000009            400.85000000009

Has anyone got an idea?



Attachments: error in sum.xlsx
Sun, Oct 20 2019 4:32 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Kees,

Probably.
Not knowing any details, if the columns are of a floating point type, it's probably just the expected representation errors.

--
Fernando Dias
[Team Elevate]
Mon, Oct 21 2019 3:12 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Kees


As Fernando says probably a float. I'm guessing that its currency so I'd suggest changing the datatype to DECIMAL(19,2)

Roy Lambert
Mon, Oct 21 2019 10:37 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Kees


Woops - just noticed I'm in the DBISAM group - so try currency

Roy Lambert
Mon, Oct 21 2019 2:08 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Roy,

I believe you meant BCD that in DBISAM is the same as DECIMAL in SQL or Currency Delphi type.

--
Fernando Dias
[Team Elevate]
Image