Received: from front2.netvisao.pt ([213.228.128.57]) by postgresql.org (8.11.3/8.11.4) with SMTP id g121RSl13139 for ; Fri, 1 Feb 2002 20:29:55 -0500 (EST) (envelope-from pocm@rnl.ist.utl.pt) Received: (qmail 7210 invoked from network); 2 Feb 2002 01:25:39 -0000 Received: from unknown (HELO localhost.localdomain) (217.129.144.243) by front2.netvisao.pt with SMTP; 2 Feb 2002 01:25:39 -0000 To: pgsql-sql@postgresql.org Subject: Fractional Results From: pocm@rnl.ist.utl.pt (Paulo J. Matos) Date: 02 Feb 2002 01:26:57 +0000 Message-ID: <874rl0y8pq.fsf@localhost.localdomain> Lines: 23 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200202/32 X-Sequence-Number: 6464 Hi all, I'm doing a sql query to get an average of some tables. SQL has an average command but unfortunately we cannot use it since out information is not in only one column, we've done the following: select temp1.espl / temp2.iluminados from (select count(*) as espl from esp) as temp1, (select count(distinct id) as iluminados from esp) as temp2; After some testing i found out that temp1.espl / temp2.iluminados gives us always the floor of the real value. I would like the fractional number instead of the floor. Any ideas on this topic? Best regards, -- Paulo J. Matos : pocm(_at_)rnl.ist.utl.pt Instituto Superior Tecnico - Lisbon Software & Computer Engineering - A.I. - > http://www.rnl.ist.utl.pt/~pocm --- Yes, God had a deadline... So, He wrote it all in Lisp!