X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 44F369DCBF7 for ; Sun, 4 Dec 2005 18:36:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36395-07 for ; Sun, 4 Dec 2005 18:36:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by postgresql.org (Postfix) with ESMTP id 173339DCBCB for ; Sun, 4 Dec 2005 18:36:48 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 04 Dec 2005 23:36:50 +0100 Subject: Re: How to get a count() where column < ''? From: Joost Kraaijeveld To: Stephan Szabo Cc: "Pgsql-sql@postgresql.org" In-Reply-To: <20051204142347.R57404@megazone.bigpanda.com> References: <1133730772.5560.8.camel@Panoramix> <20051204133233.O57404@megazone.bigpanda.com> <1133732596.5560.11.camel@Panoramix> <20051204142347.R57404@megazone.bigpanda.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sun, 04 Dec 2005 23:36:50 +0100 Message-Id: <1133735810.5560.23.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/21 X-Sequence-Number: 23563 Hi Stephan, > A query without a group by, in other words one on which the count is done > over the entire set of rows that pass the where clause. OK. > I believe > select count(*) from prototype.customers, prototype.addresses where > customers.contactaddress = addresses.objectid and zipCode < '2716BN'; > will work and give you an overall count. The working query (I did not count if the answer was correct ;-)) appears to be: SELECT COUNT(zipcode) FROM prototype.customers, prototype.addresses WHERE customers.contactaddress = addresses.objectid AND zipCode < '1234ab' -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl