X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 33CEE47592C for ; Wed, 16 Apr 2003 00:39:24 -0400 (EDT) Received: from secure.tritus.ca (baxter.tritus.ca [209.47.166.15]) by postgresql.org (Postfix) with ESMTP id 71575475458 for ; Wed, 16 Apr 2003 00:38:52 -0400 (EDT) Received: from [10.200.200.129] (CPE00045ae165bc-CM014320108734.cpe.net.cable.rogers.com [::ffff:24.157.7.10]) (AUTH: CRAM-MD5 adam@tritus.ca, TLS: TLSv1/SSLv3, 168bits, DES-CBC3-SHA) by secure.tritus.ca with esmtp; Wed, 16 Apr 2003 00:38:56 -0400 Date: Wed, 16 Apr 2003 00:38:33 -0400 From: Adam Sherman To: pgsql-sql@postgresql.org Cc: mallah@trade-india.com Subject: Re: Percentage of Total Occurances Message-ID: <71610000.1050467913@saturn> 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> X-Mailer: Mulberry/3.0.3 (Linux/x86) X-OpenPGP: 82C7 7288 650F 8F77 2FFB C170 3698 125A 79C3 FC80 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Spam-Status: No, hits=-33.1 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, QUOTE_TWICE_1,REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/245 X-Sequence-Number: 12946 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