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 D72929DCC9D for ; Sun, 4 Dec 2005 17:43:17 -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 17636-09 for ; Sun, 4 Dec 2005 17:43:14 -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 7A90F9DCC8B for ; Sun, 4 Dec 2005 17:43:15 -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 22:43:16 +0100 Subject: Re: How to get a count() where column < ''? From: Joost Kraaijeveld To: Stephan Szabo Cc: "Pgsql-sql@postgresql.org" In-Reply-To: <20051204133233.O57404@megazone.bigpanda.com> References: <1133730772.5560.8.camel@Panoramix> <20051204133233.O57404@megazone.bigpanda.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sun, 04 Dec 2005 22:43:16 +0100 Message-Id: <1133732596.5560.11.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/19 X-Sequence-Number: 23561 Hi Stephan, On Sun, 2005-12-04 at 13:33 -0800, Stephan Szabo wrote: > > SELECT COUNT(customers.objectid) FROM prototype.customers, > > prototype.addresses > > WHERE > > customers.contactaddress = addresses.objectid > > AND > > zipCode < '2716BN' > > ORDER By zipCode, houseNumber > In a non-grouped query like the above, I don't think that the order by is > meaningful. You only get one row back anyway without a group by, and > there's no single zipCode or houseNumber to associate with the row. > What do you mean by a non-grouped query? The query below gives the same error: SELECT zipcode, COUNT(*) FROM prototype.customers, prototype.addresses WHERE customers.contactaddress = addresses.objectid AND zipCode < '2716BN' -- 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