Article View: borland.public.vdbase.data.sql
Article #229Re: SQL returns only integers
From: Steve Koterski
Date: Mon, 11 Jan 1999 00:00
Date: Mon, 11 Jan 1999 00:00
31 lines
1977 bytes
1977 bytes
On Sun, 10 Jan 1999 21:44:02 +0100, tt <thomas@trautwein.com> wrote:
>i am trying to calculate averages via sql. everything works fine except
>that all numbers in my answer-table are integers. sql rounds the results
>to integers.
>
>i tried to change the number-format of my source fields ("N", 2 digits),
>but this did not work.
>
>does anybody have an idea about that?
I have not heard of the BDE doing anything like this. Perhaps someone in
the dBASE area may be familiar with a situation like this. What is the
version of the BDE used? How does the same SQL statement function when
executed from a utility external to dBASE? (Like Database Desktop.)
What is the exact statement? What is the exact data type of the table
column being averaged?
One thing you might try doing is forcing the result of the averaging to be
in a specific data type, such as NUMERIC. Do this by applying the CAST
function to the result of the AVG function. For example:
SELECT CAST(AVG(H.Pur_Price) AS NUMERIC(9, 2)) AS Avg_Price
FROM "Holdings.dbf" H
//////////////////////////////////////////////////////////////////////////
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:
<369b6710.16566284@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36991111.F42B21F0@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/11 Message-ID: <369b6710.16566284@forums.inprise.com> X-Deja-AN: 431385519 Content-Transfer-Encoding: 7bit References: <36991111.F42B21F0@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