🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11033

The Select SUM Error

#11033
From: ming
Date: Fri, 27 Dec 2002 07:42
39 lines
2558 bytes
Hi, I was hit this problem when I perform an SQL sum statement like written
below

select iva2_reckey, sum(iva2_cost) from test
group by iva2_reckey



, the expected sum result should be 0 for each grouping yet I find there is
one wired sum result displayed as 4.44089209850063E-16 for grouping valued
3.

To test the proplem, Create a paradox table name test.db with structure and
data like the following:
IVA2_RECKEY INTEGER,
IVA2_SEQNO INTEGER,
IVA2_COST NUMERIC,

PRIMARY KEY(IVA2_RECKEY, IVA2_SEQNO)

IVA2_RECKEY,    IVA2_SEQNO,    IVA2_COST,
1                            0                            43.68
1                            1                            -10.00
1                            2                            -20.00
1                            3                            -13.68
2                            0                            11.46
2                            1                            -9.50
2                            2                            -1.96
3                            0                            11.46
3                            1                            -10.40
3                            2                            -1.06
4                            0                            -11.46
4                            1                            1.06
4                            2                            10.40


just uses SQL Explorer to perform the mentioned SQL statement. Can somebody
help me in
this area? Thanks in advance for your help!
Technical Details
Message-ID: <3e0c01ce$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,f635d6d99306375d,start
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-26 23:38:42 PST
Reply-To: "ming" <wei_ming1977@yahoo.com>
From: "ming" <wei_ming1977@yahoo.com>
Newsgroups: borland.public.interbase.sql
Subject: The Select SUM Error
Date: Fri, 27 Dec 2002 15:42:03 +0800
Lines: 53
Organization: MicroForest System Sdn Bhd.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: 211.24.7.32
Message-ID: <3e0c01ce$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1040974286 211.24.7.32 (26 Dec 2002 23:31:26 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail