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 C7C189DCADA for ; Sun, 4 Dec 2005 17:12:55 -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 06570-06 for ; Sun, 4 Dec 2005 17:12:51 -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 996369DCA9F for ; Sun, 4 Dec 2005 17:12:51 -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:12:52 +0100 Subject: How to get a count() where column < ''? From: Joost Kraaijeveld To: "Pgsql-sql@postgresql.org" Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sun, 04 Dec 2005 22:12:52 +0100 Message-Id: <1133730772.5560.8.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/17 X-Sequence-Number: 23559 Hi, I want the number of customers that have a zipCode smaller tha a given value. The foolowing query doe snot work : I get an error (ERROR: column "addresses.zipcode" must appear in the GROUP BY clause or be used in an aggregate function) and I do not know how to solve it. SELECT COUNT(customers.objectid) FROM prototype.customers, prototype.addresses WHERE customers.contactaddress = addresses.objectid AND zipCode < '2716BN' ORDER By zipCode, houseNumber Anyone an idea? TIA -- 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