From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl> |
Cc: | "Pgsql-sql(at)postgresql(dot)org" <Pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: How to get a count() where column < ''? |
Date: | 2005-12-04 21:33:56 |
Message-ID: | 20051204133233.O57404@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Sun, 4 Dec 2005, Joost Kraaijeveld wrote:
> 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?
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Joost Kraaijeveld | 2005-12-04 21:43:16 | Re: How to get a count() where column < ''? |
Previous Message | Joost Kraaijeveld | 2005-12-04 21:12:52 | How to get a count() where column < ''? |