Re: Re: [GENERAL] Getting the result of a query using COUNT(*)

From: "Alexandru COSTIN" <acostin(at)rds(dot)ro>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Re: [GENERAL] Getting the result of a query using COUNT(*)
Date: 2000-08-25 06:12:07
Message-ID: X6op5.8$il3.234@nreader1.kpnqwest.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jackson Ching 2000-08-25 07:02:04 No Suitable Driver
Previous Message Tom Lane 2000-08-25 03:57:37 Re: Getting the result of a query using COUNT(*)

Browse pgsql-sql by date

  From Date Subject
Next Message Oliver Seidel 2000-08-25 06:43:20 Re: Regular expression query
Previous Message Tom Lane 2000-08-25 04:22:35 Re: Regular expression query