Article View: borland.public.vdbase.data.sql
Article #114Re: SQL returns only integers
From: tt
Date: Sat, 16 Jan 1999 00:00
Date: Sat, 16 Jan 1999 00:00
46 lines
1936 bytes
1936 bytes
steve,
sorry, i tried to show my table-data in an easy way but at second reading i
could have done better. i hope this is better to understand.
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
in the price column (where i simply selected the values), the returned values
are the same as in the table including the commas. to me it means that i do
not have a general comma-problem with my field or the bde.
in the other columns where i calculated a little bit, i only receive rounded
integers:
123,45 is rounded to 123,
234,56 is rounded to 235.
why? wtf tells him to round my values?
thanks for answering.
thomas trautwein
Technical Details
Message-ID:
<36A0CBE4.10609457@trautwein.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36991111.F42B21F0@trautwein.com> <369b6710.16566284@forums.inprise.com> <369FC156.724F04E5@trautwein.com> <36a8cdc8.24528496@forums.inprise.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: tt <thomas@trautwein.com> Subject: Re: SQL returns only integers Date: 1999/01/16 Message-ID: <36A0CBE4.10609457@trautwein.com> X-Deja-AN: 433379864 Content-Transfer-Encoding: 7bit References: <36991111.F42B21F0@trautwein.com> <369b6710.16566284@forums.inprise.com> <369FC156.724F04E5@trautwein.com> <36a8cdc8.24528496@forums.inprise.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.vdbase.data.sql