pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Sherman <adam@tritus.ca>
To: pgsql-sql@postgresql.org
Cc: mallah@trade-india.com
Subject: Re: Percentage of Total Occurances
Date: Wed, 16 Apr 2003 00:38:33 -0400
Message-ID: <71610000.1050467913@saturn> (raw)
In-Reply-To: <1608.219.65.253.230.1050435668.squirrel@mail.trade-india.com>
References: <6790000.1050418432@saturn>
	<1177.219.65.253.230.1050426637.squirrel@mail.trade-india.com>
	<30270000.1050433172@saturn>
	<1608.219.65.253.230.1050435668.squirrel@mail.trade-india.com>

On 04/16/03 01:11:08 +0530 mallah@trade-india.com wrote:

>
>
> well if everything in a single query is that imp u may do this subselect:
>
>  select answer_id ,  1.0*count(*) / (select count(*) from polls where
> poll_id = ?)       from polls where poll_id = ? group by answer_id ;
>
> and if u need to trim the trailing digits after decimal
> do to_char(value , '99.99')
>
> since u have not provided any sample data i cann't test it.


Thanks for your help, this was simpler than I thought.

A.


--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819




view thread (5+ messages)

Message-ID: <71610000.1050467913@saturn>
Permalink:  ../71610000.1050467913@saturn/
Also on:    postgresql.org/message-id/71610000.1050467913@saturn

 · 

reply

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: adam@tritus.ca, mallah@trade-india.com
  Subject: Re: Percentage of Total Occurances
  In-Reply-To: <71610000.1050467913@saturn>

* 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