🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #117

Re: SQL returns only integers

#117
From: Steve Koterski
Date: Mon, 18 Jan 1999 00:00
57 lines
3106 bytes
On Sat, 16 Jan 1999 18:27:01 +0100, tt <thomas@trautwein.com> wrote:

>my query (it is only for explanation, i know it does not make much sense):
>
>SELECT  Price ,
>    CAST(AVG(Price) AS NUMERIC(9, 2)) AS COL1,
>    SUM (Price) AS COL2,
>    AVG (Price)  AS COL3
>FROM Products
>GROUP BY Price
>
>my source table is called 'Products', the field is called 'Price'. it looks
>like this:
>
>price
>--------
>0,00
>100,00
>123,45
>234,56
>
>this is the result of the above query:
>
>price            COL1        COL2        COL3
>---------------------------------------------
>0,00            0                0                0
>100,00        100            100            100
>123,45        123            123            123
>234,56        235            235            235

Okay, understandable. However, I am unable to reproduce the results you
describe. Where are you seeing these rounded results? Within the dBASE
interface? In an external, SQL-capable utility (like Database Desktop)?

My results all produced values with two decimal places (even in those
instances where the decimal values were zeros). This using BDE 5.02,
Database Desktop 7, and a dBASE 7 table (the Price column defined as
NUMERIC with a scale of 9 and precision of 2).

Does this explain what is happening in your case? No. All it does is
indicate that there is some as yet unseen difference(s) between your
situation and mine. It could be dBASE itself producing this result.
Remember, the formatting of values retrieved by the BDE's SQL and how those
values are displayed in a user-interface are not necessarily going to be
the same. Not sure, but your numeric formatting (international decimal
symbols) may be playing a part. I cannot test for that.

What version of dBASE are you using? Version of the BDE? What kind of
table? dBASE, Paradox, other? What level of dBASE (or Paradox) table is
used? What is the defined data type of that Price column? Does this
abnormal behavior occur only with this table or with all?

//////////////////////////////////////////////////////////////////////////
Steve Koterski                      "I do most of my writing sitting down.
Technical Publications              That's where I shine."
INPRISE Corporation                         -- Robert Benchley (1889-1945)
http://www.inprise.com/delphi
Technical Details
Message-ID: <36a4b658.21531789@forums.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36991111.F42B21F0@trautwein.com> <369b6710.16566284@forums.inprise.com> <369FC156.724F04E5@trautwein.com> <36a8cdc8.24528496@forums.inprise.com> <36A0CBE4.10609457@trautwein.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,fc8f9f82181d59ea
X-Google-Attributes: gidff5a1,public
From: skoterski@NOSPAMinprise.com (Steve Koterski)
Subject: Re: SQL returns only integers
Date: 1999/01/18
Message-ID: <36a4b658.21531789@forums.inprise.com>
X-Deja-AN: 434179708
Content-Transfer-Encoding: 7bit
References: <36991111.F42B21F0@trautwein.com> <369b6710.16566284@forums.inprise.com> <369FC156.724F04E5@trautwein.com> <36a8cdc8.24528496@forums.inprise.com> <36A0CBE4.10609457@trautwein.com>
Content-Type: text/plain; charset=us-ascii
Organization: INPRISE Corporation, Technical Publications
Mime-Version: 1.0
Reply-To: skoterski@NOSPAMinprise.com
Newsgroups: borland.public.vdbase.data.sql