Received: from kodu.home.ee (isdn-54.uninet.ee [194.204.0.118]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA69792 for ; Sat, 28 Aug 1999 11:35:48 -0400 (EDT) (envelope-from hannu@trust.ee) Received: from trust.ee (hannu@localhost [127.0.0.1]) by kodu.home.ee (8.8.7/8.8.7) with ESMTP id SAA00495; Sat, 28 Aug 1999 18:48:35 +0300 Sender: hannu@kodu.home.ee Message-ID: <37C804D3.BB1B63AA@trust.ee> Date: Sat, 28 Aug 1999 18:48:35 +0300 From: Hannu Krosing Organization: Trust-O-Matic =?iso-8859-1?Q?O=DC?= X-Mailer: Mozilla 4.5 [en] (X11; U; Linux 2.2.6 i686) X-Accept-Language: en MIME-Version: 1.0 To: rodneyr@embratel.com.br CC: pgsql-interfaces@hub.org Subject: Re: [INTERFACES] AVG function References: <032567DB.00534444.00@ntrjo008.nt.embratel.com.br> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit rodneyr@embratel.com.br wrote: > > I'm using the AVG function to get the average of some integer values of my > database, > but the result is comming in the integer format too, and I'm loosing some > precision. > > Does someone know how to get the result of the AVG function in a float type, > without > changing the structure of my table? Try this: hannu=> select * from t; i - 4 4 4 4 3 (5 rows) hannu=> select avg(i * 1.0) from t; avg --- 3.8 (1 row) ------------- Hannu