How to get a count() where column < ''?

From: Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
To: "Pgsql-sql(at)postgresql(dot)org" <Pgsql-sql(at)postgresql(dot)org>
Subject: How to get a count() where column < ''?
Date: 2005-12-04 21:12:52
Message-ID: 1133730772.5560.8.camel@Panoramix
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(dot)Kraaijeveld(at)Askesis(dot)nl
web: www.askesis.nl

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2005-12-04 21:33:56 Re: How to get a count() where column < ''?
Previous Message Theodore Petrosky 2005-12-04 16:28:54 Re: question using 'between' in a sql query