Received: from news.tht.net (news.hub.org [216.126.91.242]) by hub.org (8.10.1/8.10.1) with ESMTP id e7P6PY520960 for ; Fri, 25 Aug 2000 02:25:34 -0400 (EDT) Received: (from news@localhost) by news.tht.net (8.9.3/8.9.3) id CAA07016 for pgsql-sql@postgresql.org; Fri, 25 Aug 2000 02:12:09 -0400 (EDT) (envelope-from news) X-Authentication-Warning: news.tht.net: news set sender to using -f From: "Alexandru COSTIN" X-Newsgroups: comp.databases.postgresql.sql References: <39A5E877.537238D6@vpcit.ru> Subject: Re: Re: [GENERAL] Getting the result of a query using COUNT(*) Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Fri, 25 Aug 2000 06:12:07 GMT X-Complaints-To: noc@Romania.EU.net X-Trace: nreader1.kpnqwest.net 967183927 193.226.136.126 (Fri, 25 Aug 2000 08:12:07 MET DST) Organization: KPNQwest customer news service To: pgsql-sql@postgresql.org X-Archive-Number: 200008/298 Hello Try this way: SELECT COUNT(*) as no FROM MyTable rs.getint("no"); Or SELECT COUNT(*) FROM MyTable rs.getInt(0); (or (1)) alexander > Jackson Ching wrote: > > > > Hi, > > > > I'm using JSDK 2.0 and IBM JDK 1.3 on RedHat Linux 6.2 > > > > As i test my servlet, I got errors saying count(*) column not found in a query like this > > > > SELECT COUNT(*) FROM MyTable > > > > in my rs.getint("COUNT(*)"); in oracle it works fine, in postgresql it doesn't. how should i handle aggregate functions in SQL then? > > > > Thanks > > > > Jackson > > What version of rostgres do you use? > SELECT COUNT(*) FROM MyTable works pretty well in postgres 6.5.1 and > later. > Perhaps problem is in java? > > -- > Sincerely yours, > Yury