X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3E8A152943 for ; Thu, 7 Jul 2005 05:28:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44656-08 for ; Thu, 7 Jul 2005 08:28:07 +0000 (GMT) Received: from mail.gmx.net (pop.gmx.de [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 8F9E852A01 for ; Thu, 7 Jul 2005 05:28:05 -0300 (ADT) Received: (qmail invoked by alias); 07 Jul 2005 08:28:06 -0000 Received: from p83.129.184.5.tisdip.tiscali.de (EHLO [192.168.1.2]) [83.129.184.5] by mail.gmx.net (mp007) with SMTP; 07 Jul 2005 10:28:06 +0200 X-Authenticated: #842999 Message-ID: <42CCE78B.8010507@gmx.de> Date: Thu, 07 Jul 2005 10:27:55 +0200 From: Maik Wiege Organization: end.net User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Subject: Re: get row count from a "cursor resultset" 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> In-Reply-To: <42CC6ADF.5040504@opencloud.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200507/38 X-Sequence-Number: 13186 Oliver Jowett schrieb: > Maik Wiege wrote: > > >>But what can I do about my problem? Isn't this a very >>common problem? Can't imagine any user querying a database and does not >>want to be informed how many results he got... > > > Well, as I suggested before, use DECLARE CURSOR / MOVE / FETCH, or > include a COUNT(*) column in your original query. > Hi! Could you give me an example how to do it? I can't fugure it out. If I put the COUNT(*) in my query: SELECT DISTINCT REGISTER.pd.pdkz, COUNT(*) FROM REGISTER.pd JOIN REGISTER.vornamen ON REGISTER.vornamen.pdkz = REGISTER.pd.pdkz the sql error comes up: ERROR: column "pd.pdkz" must appear in the GROUP BY clause or be used in an aggregate function Thanks for any help Maik