From: pocm@rnl.ist.utl.pt
To: pgsql-sql@postgresql.org
Subject: Fractional Results
Date: 02 Feb 2002 01:26:57 +0000
Message-ID: <874rl0y8pq.fsf@localhost.localdomain> (raw)
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!
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: pocm@rnl.ist.utl.pt
Subject: Re: Fractional Results
In-Reply-To: <874rl0y8pq.fsf@localhost.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox