From: Jim Johannsen <jjsa@gvtc.com>
Cc: Pgsql-sql@postgresql.org <Pgsql-sql@postgresql.org>
Subject: Re: How to get a count() where column < ''?
Date: Sun, 04 Dec 2005 16:17:40 -0600
Message-ID: <43936B04.3010006@gvtc.com> (raw)
In-Reply-To: <1133732596.5560.11.camel@Panoramix>
References: <1133730772.5560.8.camel@Panoramix>
<20051204133233.O57404@megazone.bigpanda.com>
<1133732596.5560.11.camel@Panoramix>
Joost Kraaijeveld wrote:
>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'
>
>
>
Try
SELECT COUNT(*)
FROM prototype.customers, prototype.addresses
WHERE customers.contactaddress = addresses.objectid
AND zipCode < '2716BN'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jjsa@gvtc.com
Subject: Re: How to get a count() where column < ''?
In-Reply-To: <43936B04.3010006@gvtc.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox