From: Alexandru COSTIN <acostin@rds.ro>
To: pgsql-sql@postgresql.org
Subject: Re: Re: [GENERAL] Getting the result of a query using COUNT(*)
Date: Fri, 25 Aug 2000 06:12:07 GMT
Message-ID: <X6op5.8$il3.234@nreader1.kpnqwest.net> (raw)
References: <39A5E877.537238D6@vpcit.ru>
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
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-sql@postgresql.org
Cc: acostin@rds.ro
Subject: Re: [GENERAL] Getting the result of a query using COUNT(*)
In-Reply-To: <X6op5.8$il3.234@nreader1.kpnqwest.net>
References: <39A5E877.537238D6@vpcit.ru> <X6op5.8$il3.234@nreader1.kpnqwest.net>
* 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