Re: get row count from a "cursor resultset"

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Maik Wiege <mswiege(at)gmx(dot)de>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: get row count from a "cursor resultset"
Date: 2005-07-07 12:26:29
Message-ID: 54B9D950-10C5-4495-9531-3F7A4406CE55@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Joseph Shraibman 2005-07-07 14:29:47 Exception from deadlock
Previous Message Maik Wiege 2005-07-07 11:29:06 Re: get row count from a "cursor resultset"