From: Dave Cramer <pg@fastcrypt.com>
To: Maik Wiege <mswiege@gmx.de>
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: get row count from a "cursor resultset"
Date: Thu, 7 Jul 2005 08:26:29 -0400
Message-ID: <54B9D950-10C5-4495-9531-3F7A4406CE55@fastcrypt.com> (raw)
In-Reply-To: <42CD1202.8030705@gmx.de>
References: <42CC2EB6.8020505@gmx.de>
<42CC5ACE.5070200@opencloud.com>
<42CC5C41.90306@opencloud.com>
<42CC604A.9050604@opencloud.com>
<42CC6A5A.2000605@gmx.de>
<42CC6ADF.5040504@opencloud.com>
<42CCE78B.8010507@gmx.de>
<42CCEFD7.2000203@opencloud.com>
<42CD1202.8030705@gmx.de>
Maik,
Your only choice may be to do two separate queries. This isn't quite
as bad as you think, as the count will load the buffers with your query
If you need exactly the right amount, make sure you do this in a
transaction.
Dave
On 7-Jul-05, at 7:29 AM, Maik Wiege wrote:
> Oliver Jowett schrieb:
>
>> Try COUNT(distinct REGISTER.pd.pdkz) perhaps
>>
> Hi!
> SELECT COUNT(DISTINCT REGISTER.pd.pdkz)
> FROM REGISTER.pd JOIN
> REGISTER.vornamen ON REGISTER.vornamen.pdkz = REGISTER.pd.pdkz
>
> works, but with that of cource I don't get the data, just the
> amount of rows, so I would have to call it another time without
> COUNT to get the data.
>
> A query like that
> SELECT COUNT(DISTINCT REGISTER.pd.pdkz), DISTINCT REGISTER.pd.pdkz
> FROM REGISTER.pd JOIN
> REGISTER.vornamen ON REGISTER.vornamen.pdkz = REGISTER.pd.pdkz
> gives the same mentioned error: column "pd.pdkz" must appear in the
> GROUP BY clause or be used in an aggregate function
>
> Any ideas anyone?
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, mswiege@gmx.de, oliver@opencloud.com
Subject: Re: get row count from a "cursor resultset"
In-Reply-To: <54B9D950-10C5-4495-9531-3F7A4406CE55@fastcrypt.com>
References: <42CC2EB6.8020505@gmx.de> <42CC5ACE.5070200@opencloud.com> <42CC5C41.90306@opencloud.com> <42CC604A.9050604@opencloud.com> <42CC6A5A.2000605@gmx.de> <42CC6ADF.5040504@opencloud.com> <42CCE78B.8010507@gmx.de> <42CCEFD7.2000203@opencloud.com> <42CD1202.8030705@gmx.de> <54B9D950-10C5-4495-9531-3F7A4406CE55@fastcrypt.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